Skip to content

Commit

Permalink
SDK regeneration (#317)
Browse files Browse the repository at this point in the history
Co-authored-by: fern-api <115122769+fern-api[bot]@users.noreply.github.com>
  • Loading branch information
fern-api[bot] authored Jul 10, 2024
1 parent ea5c81e commit 2388145
Show file tree
Hide file tree
Showing 7 changed files with 84 additions and 134 deletions.
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.4.0"
version = "v1.4.1"
description = ""
readme = "README.md"
authors = []
Expand Down
4 changes: 0 additions & 4 deletions src/elevenlabs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@
AddPronunciationDictionaryRulesResponseModel,
AddVoiceResponseModel,
Age,
AudioIsolationResponseModel,
AudioNativeCreateProjectResponseModel,
AudioNativeGetEmbedCodeResponseModel,
AudioOutput,
AudioResponseModel,
Category,
ChapterResponse,
ChapterSnapshotResponse,
Expand Down Expand Up @@ -130,11 +128,9 @@
"AddPronunciationDictionaryRulesResponseModel",
"AddVoiceResponseModel",
"Age",
"AudioIsolationResponseModel",
"AudioNativeCreateProjectResponseModel",
"AudioNativeGetEmbedCodeResponseModel",
"AudioOutput",
"AudioResponseModel",
"BodyUpdateMemberV1WorkspaceMembersPostWorkspaceRole",
"Category",
"ChapterResponse",
Expand Down
151 changes: 82 additions & 69 deletions src/elevenlabs/audio_isolation/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from ..core.request_options import RequestOptions
from ..core.unchecked_base_model import construct_type
from ..errors.unprocessable_entity_error import UnprocessableEntityError
from ..types.audio_isolation_response_model import AudioIsolationResponseModel
from ..types.http_validation_error import HttpValidationError

# this is used as the default value for optional parameters
Expand All @@ -25,7 +24,7 @@ def __init__(self, *, client_wrapper: SyncClientWrapper):

def audio_isolation(
self, *, audio: core.File, request_options: typing.Optional[RequestOptions] = None
) -> AudioIsolationResponseModel:
) -> typing.Iterator[bytes]:
"""
Removes background noise from audio
Expand All @@ -37,9 +36,9 @@ def audio_isolation(
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
AudioIsolationResponseModel
Yields
------
typing.Iterator[bytes]
Successful Response
Examples
Expand All @@ -51,7 +50,7 @@ def audio_isolation(
)
client.audio_isolation.audio_isolation()
"""
_response = self._client_wrapper.httpx_client.request(
with self._client_wrapper.httpx_client.stream(
method="POST",
url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/audio-isolation"),
params=jsonable_encoder(
Expand All @@ -77,22 +76,25 @@ def audio_isolation(
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 typing.cast(AudioIsolationResponseModel, construct_type(type_=AudioIsolationResponseModel, object_=_response.json())) # type: ignore
if _response.status_code == 422:
raise UnprocessableEntityError(
typing.cast(HttpValidationError, construct_type(type_=HttpValidationError, object_=_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)
) as _response:
if 200 <= _response.status_code < 300:
for _chunk in _response.iter_bytes():
yield _chunk
return
_response.read()
if _response.status_code == 422:
raise UnprocessableEntityError(
typing.cast(HttpValidationError, construct_type(type_=HttpValidationError, object_=_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 audio_isolation_stream(
self, *, audio: core.File, request_options: typing.Optional[RequestOptions] = None
) -> None:
) -> typing.Iterator[bytes]:
"""
Removes background noise from audio and streams the result
Expand All @@ -104,9 +106,10 @@ def audio_isolation_stream(
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
None
Yields
------
typing.Iterator[bytes]
Successful Response
Examples
--------
Expand All @@ -117,7 +120,7 @@ def audio_isolation_stream(
)
client.audio_isolation.audio_isolation_stream()
"""
_response = self._client_wrapper.httpx_client.request(
with self._client_wrapper.httpx_client.stream(
method="POST",
url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/audio-isolation/stream"),
params=jsonable_encoder(
Expand All @@ -143,18 +146,21 @@ def audio_isolation_stream(
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
if _response.status_code == 422:
raise UnprocessableEntityError(
typing.cast(HttpValidationError, construct_type(type_=HttpValidationError, object_=_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)
) as _response:
if 200 <= _response.status_code < 300:
for _chunk in _response.iter_bytes():
yield _chunk
return
_response.read()
if _response.status_code == 422:
raise UnprocessableEntityError(
typing.cast(HttpValidationError, construct_type(type_=HttpValidationError, object_=_response.json())) # type: ignore
)
try:
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, body=_response.text)
raise ApiError(status_code=_response.status_code, body=_response_json)


class AsyncAudioIsolationClient:
Expand All @@ -163,7 +169,7 @@ def __init__(self, *, client_wrapper: AsyncClientWrapper):

async def audio_isolation(
self, *, audio: core.File, request_options: typing.Optional[RequestOptions] = None
) -> AudioIsolationResponseModel:
) -> typing.AsyncIterator[bytes]:
"""
Removes background noise from audio
Expand All @@ -175,9 +181,9 @@ async def audio_isolation(
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
AudioIsolationResponseModel
Yields
------
typing.AsyncIterator[bytes]
Successful Response
Examples
Expand All @@ -189,7 +195,7 @@ async def audio_isolation(
)
await client.audio_isolation.audio_isolation()
"""
_response = await self._client_wrapper.httpx_client.request(
async with self._client_wrapper.httpx_client.stream(
method="POST",
url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/audio-isolation"),
params=jsonable_encoder(
Expand All @@ -215,22 +221,25 @@ async def audio_isolation(
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 typing.cast(AudioIsolationResponseModel, construct_type(type_=AudioIsolationResponseModel, object_=_response.json())) # type: ignore
if _response.status_code == 422:
raise UnprocessableEntityError(
typing.cast(HttpValidationError, construct_type(type_=HttpValidationError, object_=_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)
) as _response:
if 200 <= _response.status_code < 300:
async for _chunk in _response.aiter_bytes():
yield _chunk
return
await _response.aread()
if _response.status_code == 422:
raise UnprocessableEntityError(
typing.cast(HttpValidationError, construct_type(type_=HttpValidationError, object_=_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 audio_isolation_stream(
self, *, audio: core.File, request_options: typing.Optional[RequestOptions] = None
) -> None:
) -> typing.AsyncIterator[bytes]:
"""
Removes background noise from audio and streams the result
Expand All @@ -242,9 +251,10 @@ async def audio_isolation_stream(
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
None
Yields
------
typing.AsyncIterator[bytes]
Successful Response
Examples
--------
Expand All @@ -255,7 +265,7 @@ async def audio_isolation_stream(
)
await client.audio_isolation.audio_isolation_stream()
"""
_response = await self._client_wrapper.httpx_client.request(
async with self._client_wrapper.httpx_client.stream(
method="POST",
url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/audio-isolation/stream"),
params=jsonable_encoder(
Expand All @@ -281,15 +291,18 @@ async def audio_isolation_stream(
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
if _response.status_code == 422:
raise UnprocessableEntityError(
typing.cast(HttpValidationError, construct_type(type_=HttpValidationError, object_=_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)
) as _response:
if 200 <= _response.status_code < 300:
async for _chunk in _response.aiter_bytes():
yield _chunk
return
await _response.aread()
if _response.status_code == 422:
raise UnprocessableEntityError(
typing.cast(HttpValidationError, construct_type(type_=HttpValidationError, object_=_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)
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.4.0",
"X-Fern-SDK-Version": "v1.4.1",
}
if self._api_key is not None:
headers["xi-api-key"] = self._api_key
Expand Down
4 changes: 0 additions & 4 deletions src/elevenlabs/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@
from .add_pronunciation_dictionary_rules_response_model import AddPronunciationDictionaryRulesResponseModel
from .add_voice_response_model import AddVoiceResponseModel
from .age import Age
from .audio_isolation_response_model import AudioIsolationResponseModel
from .audio_native_create_project_response_model import AudioNativeCreateProjectResponseModel
from .audio_native_get_embed_code_response_model import AudioNativeGetEmbedCodeResponseModel
from .audio_output import AudioOutput
from .audio_response_model import AudioResponseModel
from .category import Category
from .chapter_response import ChapterResponse
from .chapter_snapshot_response import ChapterSnapshotResponse
Expand Down Expand Up @@ -99,11 +97,9 @@
"AddPronunciationDictionaryRulesResponseModel",
"AddVoiceResponseModel",
"Age",
"AudioIsolationResponseModel",
"AudioNativeCreateProjectResponseModel",
"AudioNativeGetEmbedCodeResponseModel",
"AudioOutput",
"AudioResponseModel",
"Category",
"ChapterResponse",
"ChapterSnapshotResponse",
Expand Down
28 changes: 0 additions & 28 deletions src/elevenlabs/types/audio_isolation_response_model.py

This file was deleted.

27 changes: 0 additions & 27 deletions src/elevenlabs/types/audio_response_model.py

This file was deleted.

0 comments on commit 2388145

Please sign in to comment.