diff --git a/pyproject.toml b/pyproject.toml index e19593d..0f3e6af 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ name = "elevenlabs" [tool.poetry] name = "elevenlabs" -version = "1.53.0" +version = "1.54.0" description = "" readme = "README.md" authors = [] diff --git a/reference.md b/reference.md index d2d45c7..83a8deb 100644 --- a/reference.md +++ b/reference.md @@ -12,7 +12,7 @@
-Returns metadata about all your generated audio. +Returns a list of your generated audio.
@@ -112,7 +112,7 @@ client.history.get_all()
-Returns information about an history item by its ID. +Retrieves a history item.
@@ -376,7 +376,7 @@ client.history.download(
-**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. +**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.
@@ -2108,6 +2108,38 @@ client.text_to_voice.create_previews(
+**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. + +
+
+ +
+
+ **request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
@@ -8137,6 +8169,14 @@ core.File` — See core.File for more documentation
+**biased_keywords:** `typing.Optional[typing.List[str]]` — A list of keywords and their biases. The keywords are the words that you want to bias the transcription towards. The biases decide how much the model should boost or suppress the keyword. The biases should be numbers between -10 and 10. The number of keywords cannot exceed 100. The length of each keyword must be less than 50 characters. Each keyword-bias pair must be separated by a colon. For example ["keyword_a:0.42", "keyword_b:-0.5"] + +
+
+ +
+
+ **request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
diff --git a/src/elevenlabs/__init__.py b/src/elevenlabs/__init__.py index ca3f011..3a7655e 100644 --- a/src/elevenlabs/__init__.py +++ b/src/elevenlabs/__init__.py @@ -107,6 +107,7 @@ DataCollectionResultCommonModel, DeleteChapterResponseModel, DeleteDubbingResponseModel, + DeleteHistoryItemResponse, DeleteProjectResponseModel, DeleteSampleResponseModel, DeleteVoiceResponseModel, @@ -346,7 +347,7 @@ WidgetFeedbackMode, WorkspaceGroupByNameResponseModel, ) -from .errors import ForbiddenError, NotFoundError, TooEarlyError, UnprocessableEntityError +from .errors import BadRequestError, ForbiddenError, NotFoundError, TooEarlyError, UnprocessableEntityError from . import ( audio_isolation, audio_native, @@ -458,6 +459,7 @@ "AudioWithTimestampsResponseModel", "AuthSettings", "AuthorizationMethod", + "BadRequestError", "BanReasonType", "BodyAddToKnowledgeBaseV1ConvaiAddToKnowledgeBasePost", "BodyAddToKnowledgeBaseV1ConvaiAgentsAgentIdAddToKnowledgeBasePost", @@ -552,6 +554,7 @@ "DataCollectionResultCommonModel", "DeleteChapterResponseModel", "DeleteDubbingResponseModel", + "DeleteHistoryItemResponse", "DeleteProjectResponseModel", "DeleteSampleResponseModel", "DeleteVoiceResponseModel", diff --git a/src/elevenlabs/core/client_wrapper.py b/src/elevenlabs/core/client_wrapper.py index a3425fa..e00f9a3 100644 --- a/src/elevenlabs/core/client_wrapper.py +++ b/src/elevenlabs/core/client_wrapper.py @@ -16,7 +16,7 @@ def get_headers(self) -> typing.Dict[str, str]: headers: typing.Dict[str, str] = { "X-Fern-Language": "Python", "X-Fern-SDK-Name": "elevenlabs", - "X-Fern-SDK-Version": "1.53.0", + "X-Fern-SDK-Version": "1.54.0", } if self._api_key is not None: headers["xi-api-key"] = self._api_key diff --git a/src/elevenlabs/errors/__init__.py b/src/elevenlabs/errors/__init__.py index 2289b82..cc9497e 100644 --- a/src/elevenlabs/errors/__init__.py +++ b/src/elevenlabs/errors/__init__.py @@ -1,8 +1,9 @@ # This file was auto-generated by Fern from our API Definition. +from .bad_request_error import BadRequestError from .forbidden_error import ForbiddenError from .not_found_error import NotFoundError from .too_early_error import TooEarlyError from .unprocessable_entity_error import UnprocessableEntityError -__all__ = ["ForbiddenError", "NotFoundError", "TooEarlyError", "UnprocessableEntityError"] +__all__ = ["BadRequestError", "ForbiddenError", "NotFoundError", "TooEarlyError", "UnprocessableEntityError"] diff --git a/src/elevenlabs/errors/bad_request_error.py b/src/elevenlabs/errors/bad_request_error.py new file mode 100644 index 0000000..9c13c61 --- /dev/null +++ b/src/elevenlabs/errors/bad_request_error.py @@ -0,0 +1,9 @@ +# This file was auto-generated by Fern from our API Definition. + +from ..core.api_error import ApiError +import typing + + +class BadRequestError(ApiError): + def __init__(self, body: typing.Optional[typing.Any]): + super().__init__(status_code=400, body=body) diff --git a/src/elevenlabs/history/client.py b/src/elevenlabs/history/client.py index fdc84c7..6a517e2 100644 --- a/src/elevenlabs/history/client.py +++ b/src/elevenlabs/history/client.py @@ -12,6 +12,8 @@ from ..core.api_error import ApiError from ..types.speech_history_item_response import SpeechHistoryItemResponse from ..core.jsonable_encoder import jsonable_encoder +from ..types.delete_history_item_response import DeleteHistoryItemResponse +from ..errors.bad_request_error import BadRequestError from ..core.client_wrapper import AsyncClientWrapper # this is used as the default value for optional parameters @@ -33,7 +35,7 @@ def get_all( request_options: typing.Optional[RequestOptions] = None, ) -> GetSpeechHistoryResponse: """ - Returns metadata about all your generated audio. + Returns a list of your generated audio. Parameters ---------- @@ -109,7 +111,7 @@ def get( self, history_item_id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> SpeechHistoryItemResponse: """ - Returns information about an history item by its ID. + Retrieves a history item. Parameters ---------- @@ -166,7 +168,7 @@ def get( def delete( self, history_item_id: str, *, request_options: typing.Optional[RequestOptions] = None - ) -> typing.Optional[typing.Any]: + ) -> DeleteHistoryItemResponse: """ Delete a history item by its ID @@ -180,7 +182,7 @@ def delete( Returns ------- - typing.Optional[typing.Any] + DeleteHistoryItemResponse Successful Response Examples @@ -202,9 +204,9 @@ def delete( try: if 200 <= _response.status_code < 300: return typing.cast( - typing.Optional[typing.Any], + DeleteHistoryItemResponse, construct_type( - type_=typing.Optional[typing.Any], # type: ignore + type_=DeleteHistoryItemResponse, # type: ignore object_=_response.json(), ), ) @@ -240,7 +242,7 @@ def get_audio( Yields ------ typing.Iterator[bytes] - Successful Response + The audio file of the history item. Examples -------- @@ -286,7 +288,7 @@ def download( history_item_ids: typing.Sequence[str], output_format: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, - ) -> 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. @@ -299,11 +301,12 @@ def download( Output format to transcode the audio file, can be wav or default. request_options : typing.Optional[RequestOptions] - Request-specific configuration. + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. - Returns - ------- - None + Yields + ------ + typing.Iterator[bytes] + The requested audio file, or a zip file containing multiple audio files when multiple history items are requested. Examples -------- @@ -316,7 +319,7 @@ def download( history_item_ids=["HISTORY_ITEM_ID"], ) """ - _response = self._client_wrapper.httpx_client.request( + with self._client_wrapper.httpx_client.stream( "v1/history/download", method="POST", json={ @@ -328,24 +331,38 @@ def download( }, request_options=request_options, omit=OMIT, - ) - try: - if 200 <= _response.status_code < 300: - return - if _response.status_code == 422: - raise UnprocessableEntityError( - typing.cast( - HttpValidationError, - construct_type( - type_=HttpValidationError, # type: ignore - object_=_response.json(), - ), + ) as _response: + try: + if 200 <= _response.status_code < 300: + _chunk_size = request_options.get("chunk_size", 1024) if request_options is not None else 1024 + for _chunk in _response.iter_bytes(chunk_size=_chunk_size): + yield _chunk + return + _response.read() + if _response.status_code == 400: + raise BadRequestError( + typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ) ) - ) - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + construct_type( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) class AsyncHistoryClient: @@ -363,7 +380,7 @@ async def get_all( request_options: typing.Optional[RequestOptions] = None, ) -> GetSpeechHistoryResponse: """ - Returns metadata about all your generated audio. + Returns a list of your generated audio. Parameters ---------- @@ -447,7 +464,7 @@ async def get( self, history_item_id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> SpeechHistoryItemResponse: """ - Returns information about an history item by its ID. + Retrieves a history item. Parameters ---------- @@ -512,7 +529,7 @@ async def main() -> None: async def delete( self, history_item_id: str, *, request_options: typing.Optional[RequestOptions] = None - ) -> typing.Optional[typing.Any]: + ) -> DeleteHistoryItemResponse: """ Delete a history item by its ID @@ -526,7 +543,7 @@ async def delete( Returns ------- - typing.Optional[typing.Any] + DeleteHistoryItemResponse Successful Response Examples @@ -556,9 +573,9 @@ async def main() -> None: try: if 200 <= _response.status_code < 300: return typing.cast( - typing.Optional[typing.Any], + DeleteHistoryItemResponse, construct_type( - type_=typing.Optional[typing.Any], # type: ignore + type_=DeleteHistoryItemResponse, # type: ignore object_=_response.json(), ), ) @@ -594,7 +611,7 @@ async def get_audio( Yields ------ typing.AsyncIterator[bytes] - Successful Response + The audio file of the history item. Examples -------- @@ -648,7 +665,7 @@ async def download( history_item_ids: typing.Sequence[str], output_format: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, - ) -> 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. @@ -661,11 +678,12 @@ async def download( Output format to transcode the audio file, can be wav or default. request_options : typing.Optional[RequestOptions] - Request-specific configuration. + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. - Returns - ------- - None + Yields + ------ + typing.AsyncIterator[bytes] + The requested audio file, or a zip file containing multiple audio files when multiple history items are requested. Examples -------- @@ -686,7 +704,7 @@ async def main() -> None: asyncio.run(main()) """ - _response = await self._client_wrapper.httpx_client.request( + async with self._client_wrapper.httpx_client.stream( "v1/history/download", method="POST", json={ @@ -698,21 +716,35 @@ async def main() -> None: }, request_options=request_options, omit=OMIT, - ) - try: - if 200 <= _response.status_code < 300: - return - if _response.status_code == 422: - raise UnprocessableEntityError( - typing.cast( - HttpValidationError, - construct_type( - type_=HttpValidationError, # type: ignore - object_=_response.json(), - ), + ) as _response: + try: + if 200 <= _response.status_code < 300: + _chunk_size = request_options.get("chunk_size", 1024) if request_options is not None else 1024 + async for _chunk in _response.aiter_bytes(chunk_size=_chunk_size): + yield _chunk + return + await _response.aread() + if _response.status_code == 400: + raise BadRequestError( + typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ) ) - ) - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) + if _response.status_code == 422: + raise UnprocessableEntityError( + typing.cast( + HttpValidationError, + construct_type( + type_=HttpValidationError, # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/elevenlabs/speech_to_text/client.py b/src/elevenlabs/speech_to_text/client.py index ee54d86..690cbc2 100644 --- a/src/elevenlabs/speech_to_text/client.py +++ b/src/elevenlabs/speech_to_text/client.py @@ -32,6 +32,7 @@ def convert( num_speakers: typing.Optional[int] = OMIT, timestamps_granularity: typing.Optional[SpeechToTextConvertRequestTimestampsGranularity] = OMIT, diarize: typing.Optional[bool] = OMIT, + biased_keywords: typing.Optional[typing.List[str]] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> SpeechToTextChunkResponseModel: """ @@ -63,6 +64,9 @@ def convert( diarize : typing.Optional[bool] Whether to annotate which speaker is currently talking in the uploaded file. + biased_keywords : typing.Optional[typing.List[str]] + A list of keywords and their biases. The keywords are the words that you want to bias the transcription towards. The biases decide how much the model should boost or suppress the keyword. The biases should be numbers between -10 and 10. The number of keywords cannot exceed 100. The length of each keyword must be less than 50 characters. Each keyword-bias pair must be separated by a colon. For example ["keyword_a:0.42", "keyword_b:-0.5"] + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -95,6 +99,7 @@ def convert( "num_speakers": num_speakers, "timestamps_granularity": timestamps_granularity, "diarize": diarize, + "biased_keywords": biased_keywords, }, files={ "file": file, @@ -142,6 +147,7 @@ async def convert( num_speakers: typing.Optional[int] = OMIT, timestamps_granularity: typing.Optional[SpeechToTextConvertRequestTimestampsGranularity] = OMIT, diarize: typing.Optional[bool] = OMIT, + biased_keywords: typing.Optional[typing.List[str]] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> SpeechToTextChunkResponseModel: """ @@ -173,6 +179,9 @@ async def convert( diarize : typing.Optional[bool] Whether to annotate which speaker is currently talking in the uploaded file. + biased_keywords : typing.Optional[typing.List[str]] + A list of keywords and their biases. The keywords are the words that you want to bias the transcription towards. The biases decide how much the model should boost or suppress the keyword. The biases should be numbers between -10 and 10. The number of keywords cannot exceed 100. The length of each keyword must be less than 50 characters. Each keyword-bias pair must be separated by a colon. For example ["keyword_a:0.42", "keyword_b:-0.5"] + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -213,6 +222,7 @@ async def main() -> None: "num_speakers": num_speakers, "timestamps_granularity": timestamps_granularity, "diarize": diarize, + "biased_keywords": biased_keywords, }, files={ "file": file, diff --git a/src/elevenlabs/text_to_voice/client.py b/src/elevenlabs/text_to_voice/client.py index c524046..594e72b 100644 --- a/src/elevenlabs/text_to_voice/client.py +++ b/src/elevenlabs/text_to_voice/client.py @@ -28,6 +28,10 @@ def create_previews( text: str, output_format: typing.Optional[TextToVoiceCreatePreviewsRequestOutputFormat] = None, 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, request_options: typing.Optional[RequestOptions] = None, ) -> VoicePreviewsResponseModel: """ @@ -47,6 +51,18 @@ def create_previews( 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. + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -77,6 +93,10 @@ def create_previews( "voice_description": voice_description, "text": text, "auto_generate_text": auto_generate_text, + "loudness": loudness, + "quality": quality, + "seed": seed, + "guidance_scale": guidance_scale, }, headers={ "content-type": "application/json", @@ -211,6 +231,10 @@ async def create_previews( text: str, output_format: typing.Optional[TextToVoiceCreatePreviewsRequestOutputFormat] = None, 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, request_options: typing.Optional[RequestOptions] = None, ) -> VoicePreviewsResponseModel: """ @@ -230,6 +254,18 @@ async def create_previews( 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. + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -268,6 +304,10 @@ async def main() -> None: "voice_description": voice_description, "text": text, "auto_generate_text": auto_generate_text, + "loudness": loudness, + "quality": quality, + "seed": seed, + "guidance_scale": guidance_scale, }, headers={ "content-type": "application/json", diff --git a/src/elevenlabs/types/__init__.py b/src/elevenlabs/types/__init__.py index b23b948..10f95bf 100644 --- a/src/elevenlabs/types/__init__.py +++ b/src/elevenlabs/types/__init__.py @@ -122,6 +122,7 @@ from .data_collection_result_common_model import DataCollectionResultCommonModel from .delete_chapter_response_model import DeleteChapterResponseModel from .delete_dubbing_response_model import DeleteDubbingResponseModel +from .delete_history_item_response import DeleteHistoryItemResponse from .delete_project_response_model import DeleteProjectResponseModel from .delete_sample_response_model import DeleteSampleResponseModel from .delete_voice_response_model import DeleteVoiceResponseModel @@ -482,6 +483,7 @@ "DataCollectionResultCommonModel", "DeleteChapterResponseModel", "DeleteDubbingResponseModel", + "DeleteHistoryItemResponse", "DeleteProjectResponseModel", "DeleteSampleResponseModel", "DeleteVoiceResponseModel", diff --git a/src/elevenlabs/types/delete_history_item_response.py b/src/elevenlabs/types/delete_history_item_response.py new file mode 100644 index 0000000..57422ee --- /dev/null +++ b/src/elevenlabs/types/delete_history_item_response.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +from ..core.unchecked_base_model import UncheckedBaseModel +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import typing + + +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/src/elevenlabs/types/feedback_item.py b/src/elevenlabs/types/feedback_item.py index ce85716..5b58eeb 100644 --- a/src/elevenlabs/types/feedback_item.py +++ b/src/elevenlabs/types/feedback_item.py @@ -1,20 +1,51 @@ # This file was auto-generated by Fern from our API Definition. from ..core.unchecked_base_model import UncheckedBaseModel +import pydantic import typing from ..core.pydantic_utilities import IS_PYDANTIC_V2 -import pydantic class FeedbackItem(UncheckedBaseModel): - thumbs_up: bool - feedback: str - emotions: bool - inaccurate_clone: bool - glitches: bool - audio_quality: bool - other: bool - review_status: typing.Optional[str] = None + thumbs_up: bool = pydantic.Field() + """ + Whether the user liked the generated item. + """ + + feedback: str = pydantic.Field() + """ + The feedback text provided by the user. + """ + + emotions: bool = pydantic.Field() + """ + Whether the user provided emotions. + """ + + inaccurate_clone: bool = pydantic.Field() + """ + Whether the user thinks the clone is inaccurate. + """ + + glitches: bool = pydantic.Field() + """ + Whether the user thinks there are glitches in the audio. + """ + + audio_quality: bool = pydantic.Field() + """ + Whether the user thinks the audio quality is good. + """ + + other: bool = pydantic.Field() + """ + Whether the user provided other feedback. + """ + + review_status: typing.Optional[str] = pydantic.Field(default=None) + """ + The review status of the item. Defaults to 'not_reviewed'. + """ if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 diff --git a/src/elevenlabs/types/get_speech_history_response.py b/src/elevenlabs/types/get_speech_history_response.py index 2abe50b..7f32492 100644 --- a/src/elevenlabs/types/get_speech_history_response.py +++ b/src/elevenlabs/types/get_speech_history_response.py @@ -3,14 +3,25 @@ from ..core.unchecked_base_model import UncheckedBaseModel import typing from .speech_history_item_response import SpeechHistoryItemResponse -from ..core.pydantic_utilities import IS_PYDANTIC_V2 import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 class GetSpeechHistoryResponse(UncheckedBaseModel): - history: typing.List[SpeechHistoryItemResponse] - last_history_item_id: str - has_more: bool + 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. + """ if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 diff --git a/src/elevenlabs/types/history_alignment_response_model.py b/src/elevenlabs/types/history_alignment_response_model.py index f1d3878..e34a9c2 100644 --- a/src/elevenlabs/types/history_alignment_response_model.py +++ b/src/elevenlabs/types/history_alignment_response_model.py @@ -2,14 +2,25 @@ from ..core.unchecked_base_model import UncheckedBaseModel import typing -from ..core.pydantic_utilities import IS_PYDANTIC_V2 import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 class HistoryAlignmentResponseModel(UncheckedBaseModel): - characters: typing.List[str] - character_start_times_seconds: typing.List[float] - character_end_times_seconds: typing.List[float] + 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 diff --git a/src/elevenlabs/types/history_alignments_response_model.py b/src/elevenlabs/types/history_alignments_response_model.py index ca1d67b..9b8715b 100644 --- a/src/elevenlabs/types/history_alignments_response_model.py +++ b/src/elevenlabs/types/history_alignments_response_model.py @@ -2,14 +2,21 @@ from ..core.unchecked_base_model import UncheckedBaseModel from .history_alignment_response_model import HistoryAlignmentResponseModel +import pydantic from ..core.pydantic_utilities import IS_PYDANTIC_V2 import typing -import pydantic class HistoryAlignmentsResponseModel(UncheckedBaseModel): - alignment: HistoryAlignmentResponseModel - normalized_alignment: HistoryAlignmentResponseModel + 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 diff --git a/src/elevenlabs/types/speech_history_item_response.py b/src/elevenlabs/types/speech_history_item_response.py index 783c55d..7ff5788 100644 --- a/src/elevenlabs/types/speech_history_item_response.py +++ b/src/elevenlabs/types/speech_history_item_response.py @@ -1,33 +1,96 @@ # This file was auto-generated by Fern from our API Definition. from ..core.unchecked_base_model import UncheckedBaseModel +import pydantic import typing from .speech_history_item_response_model_voice_category import SpeechHistoryItemResponseModelVoiceCategory from .feedback_item import FeedbackItem from .speech_history_item_response_model_source import SpeechHistoryItemResponseModelSource from .history_alignments_response_model import HistoryAlignmentsResponseModel from ..core.pydantic_utilities import IS_PYDANTIC_V2 -import pydantic class SpeechHistoryItemResponse(UncheckedBaseModel): - history_item_id: str - request_id: typing.Optional[str] = None - voice_id: typing.Optional[str] = None - model_id: typing.Optional[str] = None - voice_name: typing.Optional[str] = None - voice_category: typing.Optional[SpeechHistoryItemResponseModelVoiceCategory] = None - text: typing.Optional[str] = None - date_unix: typing.Optional[int] = None - character_count_change_from: typing.Optional[int] = None - character_count_change_to: typing.Optional[int] = None - content_type: typing.Optional[str] = None + 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[SpeechHistoryItemResponseModelVoiceCategory] = 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: typing.Optional[int] = pydantic.Field(default=None) + """ + Unix timestamp of when the item was created. + """ + + character_count_change_from: typing.Optional[int] = pydantic.Field(default=None) + """ + The character count change from. + """ + + character_count_change_to: typing.Optional[int] = pydantic.Field(default=None) + """ + The character count change to. + """ + + content_type: typing.Optional[str] = pydantic.Field(default=None) + """ + The content type of the generated item. + """ + state: typing.Optional[typing.Optional[typing.Any]] = None - settings: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = None - feedback: typing.Optional[FeedbackItem] = None - share_link_id: typing.Optional[str] = None - source: typing.Optional[SpeechHistoryItemResponseModelSource] = None - alignments: typing.Optional[HistoryAlignmentsResponseModel] = None + settings: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = pydantic.Field(default=None) + """ + The settings of the history item. + """ + + feedback: typing.Optional[FeedbackItem] = pydantic.Field(default=None) + """ + Feedback associated with the generated item. Returns null if no feedback has been provided. + """ + + share_link_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The ID of the share link. + """ + + source: typing.Optional[SpeechHistoryItemResponseModelSource] = pydantic.Field(default=None) + """ + The source of the history item. Either TTS (text to speech), STS (speech to text) or STT (speech to text). + """ + + alignments: typing.Optional[HistoryAlignmentsResponseModel] = pydantic.Field(default=None) + """ + The alignments of the history item. + """ if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 diff --git a/src/elevenlabs/types/speech_history_item_response_model_source.py b/src/elevenlabs/types/speech_history_item_response_model_source.py index 7ed8484..75c87a2 100644 --- a/src/elevenlabs/types/speech_history_item_response_model_source.py +++ b/src/elevenlabs/types/speech_history_item_response_model_source.py @@ -2,4 +2,4 @@ import typing -SpeechHistoryItemResponseModelSource = typing.Union[typing.Literal["TTS", "STS"], typing.Any] +SpeechHistoryItemResponseModelSource = typing.Union[typing.Literal["TTS", "STS", "STT"], typing.Any] diff --git a/src/elevenlabs/types/usage_characters_response_model.py b/src/elevenlabs/types/usage_characters_response_model.py index b817152..0f3f2e2 100644 --- a/src/elevenlabs/types/usage_characters_response_model.py +++ b/src/elevenlabs/types/usage_characters_response_model.py @@ -2,13 +2,20 @@ from ..core.unchecked_base_model import UncheckedBaseModel import typing -from ..core.pydantic_utilities import IS_PYDANTIC_V2 import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 class UsageCharactersResponseModel(UncheckedBaseModel): - time: typing.List[int] - usage: typing.Dict[str, typing.List[int]] + time: typing.List[int] = pydantic.Field() + """ + The time axis with unix timestamps for each day. + """ + + usage: typing.Dict[str, typing.List[int]] = 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