Skip to content

Commit

Permalink
(release): version v1.0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] authored Apr 8, 2024
1 parent c7c58ba commit 8102e6f
Show file tree
Hide file tree
Showing 15 changed files with 275 additions and 36 deletions.
16 changes: 8 additions & 8 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "elevenlabs"
version = "v1.0.4"
version = "v1.0.5"
description = ""
readme = "README.md"
authors = []
Expand Down
2 changes: 2 additions & 0 deletions src/elevenlabs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
ChapterStatisticsResponse,
Currency,
DoDubbingResponse,
DubbingMetadataResponse,
ExtendedSubscriptionResponseModelBillingPeriod,
FeedbackItem,
FineTuningResponse,
Expand Down Expand Up @@ -109,6 +110,7 @@
"ChapterStatisticsResponse",
"Currency",
"DoDubbingResponse",
"DubbingMetadataResponse",
"ElevenLabsEnvironment",
"ExtendedSubscriptionResponseModelBillingPeriod",
"FeedbackItem",
Expand Down
2 changes: 1 addition & 1 deletion src/elevenlabs/core/client_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,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": "v1.0.4",
"X-Fern-SDK-Version": "v1.0.5",
}
if self._api_key is not None:
headers["xi-api-key"] = self._api_key
Expand Down
21 changes: 11 additions & 10 deletions src/elevenlabs/dubbing/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from ..core.request_options import RequestOptions
from ..errors.unprocessable_entity_error import UnprocessableEntityError
from ..types.do_dubbing_response import DoDubbingResponse
from ..types.dubbing_metadata_response import DubbingMetadataResponse
from ..types.http_validation_error import HttpValidationError

try:
Expand Down Expand Up @@ -170,7 +171,7 @@ def dub_a_video_or_an_audio_file(

def get_dubbing_project_metadata(
self, dubbing_id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> typing.Any:
) -> DubbingMetadataResponse:
"""
Returns metadata about a dubbing project, including whether it's still in progress or not
Expand Down Expand Up @@ -211,7 +212,7 @@ def get_dubbing_project_metadata(
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
)
if 200 <= _response.status_code < 300:
return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
return pydantic.parse_obj_as(DubbingMetadataResponse, _response.json()) # type: ignore
if _response.status_code == 422:
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
try:
Expand Down Expand Up @@ -274,9 +275,9 @@ def delete_dubbing_project(

def get_dubbed_file(
self, dubbing_id: str, language_code: str, *, request_options: typing.Optional[RequestOptions] = None
) -> typing.Any:
) -> None:
"""
Returns dubbed file.
Returns dubbed file as a streamed file. Videos will be returned in MP4 format and audio only dubs will be returned in MP3.
Parameters:
- dubbing_id: str. ID of the dubbing project.
Expand Down Expand Up @@ -319,7 +320,7 @@ def get_dubbed_file(
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
)
if 200 <= _response.status_code < 300:
return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
return
if _response.status_code == 422:
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
try:
Expand Down Expand Up @@ -476,7 +477,7 @@ async def dub_a_video_or_an_audio_file(

async def get_dubbing_project_metadata(
self, dubbing_id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> typing.Any:
) -> DubbingMetadataResponse:
"""
Returns metadata about a dubbing project, including whether it's still in progress or not
Expand Down Expand Up @@ -517,7 +518,7 @@ async def get_dubbing_project_metadata(
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
)
if 200 <= _response.status_code < 300:
return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
return pydantic.parse_obj_as(DubbingMetadataResponse, _response.json()) # type: ignore
if _response.status_code == 422:
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
try:
Expand Down Expand Up @@ -580,9 +581,9 @@ async def delete_dubbing_project(

async def get_dubbed_file(
self, dubbing_id: str, language_code: str, *, request_options: typing.Optional[RequestOptions] = None
) -> typing.Any:
) -> None:
"""
Returns dubbed file.
Returns dubbed file as a streamed file. Videos will be returned in MP4 format and audio only dubs will be returned in MP3.
Parameters:
- dubbing_id: str. ID of the dubbing project.
Expand Down Expand Up @@ -625,7 +626,7 @@ async def get_dubbed_file(
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
)
if 200 <= _response.status_code < 300:
return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
return
if _response.status_code == 422:
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
try:
Expand Down
32 changes: 25 additions & 7 deletions src/elevenlabs/history/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,14 +251,20 @@ def get_audio(
raise ApiError(status_code=_response.status_code, body=_response_json)

def download(
self, *, history_item_ids: typing.Sequence[str], request_options: typing.Optional[RequestOptions] = None
self,
*,
history_item_ids: typing.Sequence[str],
output_format: typing.Optional[str] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> None:
"""
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.
---
from elevenlabs.client import ElevenLabs
Expand All @@ -270,16 +276,19 @@ def download(
history_item_ids=["history_item_ids"],
)
"""
_request: typing.Dict[str, typing.Any] = {"history_item_ids": history_item_ids}
if output_format is not OMIT:
_request["output_format"] = output_format
_response = self._client_wrapper.httpx_client.request(
"POST",
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/history/download"),
params=jsonable_encoder(
request_options.get("additional_query_parameters") if request_options is not None else None
),
json=jsonable_encoder({"history_item_ids": history_item_ids})
json=jsonable_encoder(_request)
if request_options is None or request_options.get("additional_body_parameters") is None
else {
**jsonable_encoder({"history_item_ids": history_item_ids}),
**jsonable_encoder(_request),
**(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
},
headers=jsonable_encoder(
Expand Down Expand Up @@ -503,7 +512,7 @@ async def get_audio(
history_item_id="string",
)
"""
async with await self._client_wrapper.httpx_client.stream(
async with self._client_wrapper.httpx_client.stream(
"GET",
urllib.parse.urljoin(
f"{self._client_wrapper.get_base_url()}/", f"v1/history/{jsonable_encoder(history_item_id)}/audio"
Expand Down Expand Up @@ -537,14 +546,20 @@ async def get_audio(
raise ApiError(status_code=_response.status_code, body=_response_json)

async def download(
self, *, history_item_ids: typing.Sequence[str], request_options: typing.Optional[RequestOptions] = None
self,
*,
history_item_ids: typing.Sequence[str],
output_format: typing.Optional[str] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> None:
"""
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.
---
from elevenlabs.client import AsyncElevenLabs
Expand All @@ -556,16 +571,19 @@ async def download(
history_item_ids=["history_item_ids"],
)
"""
_request: typing.Dict[str, typing.Any] = {"history_item_ids": history_item_ids}
if output_format is not OMIT:
_request["output_format"] = output_format
_response = await self._client_wrapper.httpx_client.request(
"POST",
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/history/download"),
params=jsonable_encoder(
request_options.get("additional_query_parameters") if request_options is not None else None
),
json=jsonable_encoder({"history_item_ids": history_item_ids})
json=jsonable_encoder(_request)
if request_options is None or request_options.get("additional_body_parameters") is None
else {
**jsonable_encoder({"history_item_ids": history_item_ids}),
**jsonable_encoder(_request),
**(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
},
headers=jsonable_encoder(
Expand Down
112 changes: 112 additions & 0 deletions src/elevenlabs/pronunciation_dictionary/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,62 @@ def add_from_file(
raise ApiError(status_code=_response.status_code, body=_response.text)
raise ApiError(status_code=_response.status_code, body=_response_json)

def get_pls_file_with_a_pronunciation_dictionary_version_rules(
self, dictionary_id: str, version_id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> typing.Any:
"""
Get 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 version of the pronunciation dictionary
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
---
from elevenlabs.client import ElevenLabs
client = ElevenLabs(
api_key="YOUR_API_KEY",
)
client.pronunciation_dictionary.get_pls_file_with_a_pronunciation_dictionary_version_rules(
dictionary_id="dictionary_id",
version_id="version_id",
)
"""
_response = self._client_wrapper.httpx_client.request(
"GET",
urllib.parse.urljoin(
f"{self._client_wrapper.get_base_url()}/",
f"v1/pronunciation-dictionaries/{jsonable_encoder(dictionary_id)}/{jsonable_encoder(version_id)}/download",
),
params=jsonable_encoder(
request_options.get("additional_query_parameters") if request_options is not None else None
),
headers=jsonable_encoder(
remove_none_from_dict(
{
**self._client_wrapper.get_headers(),
**(request_options.get("additional_headers", {}) if request_options is not None else {}),
}
)
),
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._client_wrapper.get_timeout(),
retries=0,
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
)
if 200 <= _response.status_code < 300:
return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
if _response.status_code == 422:
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
try:
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, body=_response.text)
raise ApiError(status_code=_response.status_code, body=_response_json)

def get_metadata_for_a_pronunciation_dictionary_v_1_pronunciation_dictionaries_pronunciation_dictionary_id_get(
self, pronunciation_dictionary_id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> GetPronunciationDictionaryMetadataResponse:
Expand Down Expand Up @@ -218,6 +274,62 @@ async def add_from_file(
raise ApiError(status_code=_response.status_code, body=_response.text)
raise ApiError(status_code=_response.status_code, body=_response_json)

async def get_pls_file_with_a_pronunciation_dictionary_version_rules(
self, dictionary_id: str, version_id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> typing.Any:
"""
Get 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 version of the pronunciation dictionary
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
---
from elevenlabs.client import AsyncElevenLabs
client = AsyncElevenLabs(
api_key="YOUR_API_KEY",
)
await client.pronunciation_dictionary.get_pls_file_with_a_pronunciation_dictionary_version_rules(
dictionary_id="dictionary_id",
version_id="version_id",
)
"""
_response = await self._client_wrapper.httpx_client.request(
"GET",
urllib.parse.urljoin(
f"{self._client_wrapper.get_base_url()}/",
f"v1/pronunciation-dictionaries/{jsonable_encoder(dictionary_id)}/{jsonable_encoder(version_id)}/download",
),
params=jsonable_encoder(
request_options.get("additional_query_parameters") if request_options is not None else None
),
headers=jsonable_encoder(
remove_none_from_dict(
{
**self._client_wrapper.get_headers(),
**(request_options.get("additional_headers", {}) if request_options is not None else {}),
}
)
),
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._client_wrapper.get_timeout(),
retries=0,
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
)
if 200 <= _response.status_code < 300:
return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
if _response.status_code == 422:
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
try:
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, body=_response.text)
raise ApiError(status_code=_response.status_code, body=_response_json)

async def get_metadata_for_a_pronunciation_dictionary_v_1_pronunciation_dictionaries_pronunciation_dictionary_id_get(
self, pronunciation_dictionary_id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> GetPronunciationDictionaryMetadataResponse:
Expand Down
Loading

0 comments on commit 8102e6f

Please sign in to comment.