Skip to content

Commit ea5c81e

Browse files
SDK regeneration (elevenlabs#315)
Co-authored-by: fern-api <115122769+fern-api[bot]@users.noreply.github.com>
1 parent 0fd1723 commit ea5c81e

File tree

10 files changed

+468
-90
lines changed

10 files changed

+468
-90
lines changed

poetry.lock

Lines changed: 101 additions & 88 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "elevenlabs"
3-
version = "v1.3.1"
3+
version = "v1.4.0"
44
description = ""
55
readme = "README.md"
66
authors = []

src/elevenlabs/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@
77
AddPronunciationDictionaryRulesResponseModel,
88
AddVoiceResponseModel,
99
Age,
10+
AudioIsolationResponseModel,
1011
AudioNativeCreateProjectResponseModel,
1112
AudioNativeGetEmbedCodeResponseModel,
1213
AudioOutput,
14+
AudioResponseModel,
1315
Category,
1416
ChapterResponse,
1517
ChapterSnapshotResponse,
@@ -91,6 +93,7 @@
9193
)
9294
from .errors import UnprocessableEntityError
9395
from . import (
96+
audio_isolation,
9497
audio_native,
9598
chapters,
9699
dubbing,
@@ -127,9 +130,11 @@
127130
"AddPronunciationDictionaryRulesResponseModel",
128131
"AddVoiceResponseModel",
129132
"Age",
133+
"AudioIsolationResponseModel",
130134
"AudioNativeCreateProjectResponseModel",
131135
"AudioNativeGetEmbedCodeResponseModel",
132136
"AudioOutput",
137+
"AudioResponseModel",
133138
"BodyUpdateMemberV1WorkspaceMembersPostWorkspaceRole",
134139
"Category",
135140
"ChapterResponse",
@@ -218,6 +223,7 @@
218223
"VoiceSharingState",
219224
"VoiceVerificationResponse",
220225
"__version__",
226+
"audio_isolation",
221227
"audio_native",
222228
"chapters",
223229
"dubbing",
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# This file was auto-generated by Fern from our API Definition.
2+
Lines changed: 295 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,295 @@
1+
# This file was auto-generated by Fern from our API Definition.
2+
3+
import typing
4+
import urllib.parse
5+
from json.decoder import JSONDecodeError
6+
7+
from .. import core
8+
from ..core.api_error import ApiError
9+
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
10+
from ..core.jsonable_encoder import jsonable_encoder
11+
from ..core.remove_none_from_dict import remove_none_from_dict
12+
from ..core.request_options import RequestOptions
13+
from ..core.unchecked_base_model import construct_type
14+
from ..errors.unprocessable_entity_error import UnprocessableEntityError
15+
from ..types.audio_isolation_response_model import AudioIsolationResponseModel
16+
from ..types.http_validation_error import HttpValidationError
17+
18+
# this is used as the default value for optional parameters
19+
OMIT = typing.cast(typing.Any, ...)
20+
21+
22+
class AudioIsolationClient:
23+
def __init__(self, *, client_wrapper: SyncClientWrapper):
24+
self._client_wrapper = client_wrapper
25+
26+
def audio_isolation(
27+
self, *, audio: core.File, request_options: typing.Optional[RequestOptions] = None
28+
) -> AudioIsolationResponseModel:
29+
"""
30+
Removes background noise from audio
31+
32+
Parameters
33+
----------
34+
audio : core.File
35+
See core.File for more documentation
36+
37+
request_options : typing.Optional[RequestOptions]
38+
Request-specific configuration.
39+
40+
Returns
41+
-------
42+
AudioIsolationResponseModel
43+
Successful Response
44+
45+
Examples
46+
--------
47+
from elevenlabs.client import ElevenLabs
48+
49+
client = ElevenLabs(
50+
api_key="YOUR_API_KEY",
51+
)
52+
client.audio_isolation.audio_isolation()
53+
"""
54+
_response = self._client_wrapper.httpx_client.request(
55+
method="POST",
56+
url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/audio-isolation"),
57+
params=jsonable_encoder(
58+
request_options.get("additional_query_parameters") if request_options is not None else None
59+
),
60+
data=jsonable_encoder(remove_none_from_dict({}))
61+
if request_options is None or request_options.get("additional_body_parameters") is None
62+
else {
63+
**jsonable_encoder(remove_none_from_dict({})),
64+
**(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
65+
},
66+
files=core.convert_file_dict_to_httpx_tuples(remove_none_from_dict({"audio": audio})),
67+
headers=jsonable_encoder(
68+
remove_none_from_dict(
69+
{
70+
**self._client_wrapper.get_headers(),
71+
**(request_options.get("additional_headers", {}) if request_options is not None else {}),
72+
}
73+
)
74+
),
75+
timeout=request_options.get("timeout_in_seconds")
76+
if request_options is not None and request_options.get("timeout_in_seconds") is not None
77+
else self._client_wrapper.get_timeout(),
78+
retries=0,
79+
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
80+
)
81+
if 200 <= _response.status_code < 300:
82+
return typing.cast(AudioIsolationResponseModel, construct_type(type_=AudioIsolationResponseModel, object_=_response.json())) # type: ignore
83+
if _response.status_code == 422:
84+
raise UnprocessableEntityError(
85+
typing.cast(HttpValidationError, construct_type(type_=HttpValidationError, object_=_response.json())) # type: ignore
86+
)
87+
try:
88+
_response_json = _response.json()
89+
except JSONDecodeError:
90+
raise ApiError(status_code=_response.status_code, body=_response.text)
91+
raise ApiError(status_code=_response.status_code, body=_response_json)
92+
93+
def audio_isolation_stream(
94+
self, *, audio: core.File, request_options: typing.Optional[RequestOptions] = None
95+
) -> None:
96+
"""
97+
Removes background noise from audio and streams the result
98+
99+
Parameters
100+
----------
101+
audio : core.File
102+
See core.File for more documentation
103+
104+
request_options : typing.Optional[RequestOptions]
105+
Request-specific configuration.
106+
107+
Returns
108+
-------
109+
None
110+
111+
Examples
112+
--------
113+
from elevenlabs.client import ElevenLabs
114+
115+
client = ElevenLabs(
116+
api_key="YOUR_API_KEY",
117+
)
118+
client.audio_isolation.audio_isolation_stream()
119+
"""
120+
_response = self._client_wrapper.httpx_client.request(
121+
method="POST",
122+
url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/audio-isolation/stream"),
123+
params=jsonable_encoder(
124+
request_options.get("additional_query_parameters") if request_options is not None else None
125+
),
126+
data=jsonable_encoder(remove_none_from_dict({}))
127+
if request_options is None or request_options.get("additional_body_parameters") is None
128+
else {
129+
**jsonable_encoder(remove_none_from_dict({})),
130+
**(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
131+
},
132+
files=core.convert_file_dict_to_httpx_tuples(remove_none_from_dict({"audio": audio})),
133+
headers=jsonable_encoder(
134+
remove_none_from_dict(
135+
{
136+
**self._client_wrapper.get_headers(),
137+
**(request_options.get("additional_headers", {}) if request_options is not None else {}),
138+
}
139+
)
140+
),
141+
timeout=request_options.get("timeout_in_seconds")
142+
if request_options is not None and request_options.get("timeout_in_seconds") is not None
143+
else self._client_wrapper.get_timeout(),
144+
retries=0,
145+
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
146+
)
147+
if 200 <= _response.status_code < 300:
148+
return
149+
if _response.status_code == 422:
150+
raise UnprocessableEntityError(
151+
typing.cast(HttpValidationError, construct_type(type_=HttpValidationError, object_=_response.json())) # type: ignore
152+
)
153+
try:
154+
_response_json = _response.json()
155+
except JSONDecodeError:
156+
raise ApiError(status_code=_response.status_code, body=_response.text)
157+
raise ApiError(status_code=_response.status_code, body=_response_json)
158+
159+
160+
class AsyncAudioIsolationClient:
161+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
162+
self._client_wrapper = client_wrapper
163+
164+
async def audio_isolation(
165+
self, *, audio: core.File, request_options: typing.Optional[RequestOptions] = None
166+
) -> AudioIsolationResponseModel:
167+
"""
168+
Removes background noise from audio
169+
170+
Parameters
171+
----------
172+
audio : core.File
173+
See core.File for more documentation
174+
175+
request_options : typing.Optional[RequestOptions]
176+
Request-specific configuration.
177+
178+
Returns
179+
-------
180+
AudioIsolationResponseModel
181+
Successful Response
182+
183+
Examples
184+
--------
185+
from elevenlabs.client import AsyncElevenLabs
186+
187+
client = AsyncElevenLabs(
188+
api_key="YOUR_API_KEY",
189+
)
190+
await client.audio_isolation.audio_isolation()
191+
"""
192+
_response = await self._client_wrapper.httpx_client.request(
193+
method="POST",
194+
url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/audio-isolation"),
195+
params=jsonable_encoder(
196+
request_options.get("additional_query_parameters") if request_options is not None else None
197+
),
198+
data=jsonable_encoder(remove_none_from_dict({}))
199+
if request_options is None or request_options.get("additional_body_parameters") is None
200+
else {
201+
**jsonable_encoder(remove_none_from_dict({})),
202+
**(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
203+
},
204+
files=core.convert_file_dict_to_httpx_tuples(remove_none_from_dict({"audio": audio})),
205+
headers=jsonable_encoder(
206+
remove_none_from_dict(
207+
{
208+
**self._client_wrapper.get_headers(),
209+
**(request_options.get("additional_headers", {}) if request_options is not None else {}),
210+
}
211+
)
212+
),
213+
timeout=request_options.get("timeout_in_seconds")
214+
if request_options is not None and request_options.get("timeout_in_seconds") is not None
215+
else self._client_wrapper.get_timeout(),
216+
retries=0,
217+
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
218+
)
219+
if 200 <= _response.status_code < 300:
220+
return typing.cast(AudioIsolationResponseModel, construct_type(type_=AudioIsolationResponseModel, object_=_response.json())) # type: ignore
221+
if _response.status_code == 422:
222+
raise UnprocessableEntityError(
223+
typing.cast(HttpValidationError, construct_type(type_=HttpValidationError, object_=_response.json())) # type: ignore
224+
)
225+
try:
226+
_response_json = _response.json()
227+
except JSONDecodeError:
228+
raise ApiError(status_code=_response.status_code, body=_response.text)
229+
raise ApiError(status_code=_response.status_code, body=_response_json)
230+
231+
async def audio_isolation_stream(
232+
self, *, audio: core.File, request_options: typing.Optional[RequestOptions] = None
233+
) -> None:
234+
"""
235+
Removes background noise from audio and streams the result
236+
237+
Parameters
238+
----------
239+
audio : core.File
240+
See core.File for more documentation
241+
242+
request_options : typing.Optional[RequestOptions]
243+
Request-specific configuration.
244+
245+
Returns
246+
-------
247+
None
248+
249+
Examples
250+
--------
251+
from elevenlabs.client import AsyncElevenLabs
252+
253+
client = AsyncElevenLabs(
254+
api_key="YOUR_API_KEY",
255+
)
256+
await client.audio_isolation.audio_isolation_stream()
257+
"""
258+
_response = await self._client_wrapper.httpx_client.request(
259+
method="POST",
260+
url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/audio-isolation/stream"),
261+
params=jsonable_encoder(
262+
request_options.get("additional_query_parameters") if request_options is not None else None
263+
),
264+
data=jsonable_encoder(remove_none_from_dict({}))
265+
if request_options is None or request_options.get("additional_body_parameters") is None
266+
else {
267+
**jsonable_encoder(remove_none_from_dict({})),
268+
**(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
269+
},
270+
files=core.convert_file_dict_to_httpx_tuples(remove_none_from_dict({"audio": audio})),
271+
headers=jsonable_encoder(
272+
remove_none_from_dict(
273+
{
274+
**self._client_wrapper.get_headers(),
275+
**(request_options.get("additional_headers", {}) if request_options is not None else {}),
276+
}
277+
)
278+
),
279+
timeout=request_options.get("timeout_in_seconds")
280+
if request_options is not None and request_options.get("timeout_in_seconds") is not None
281+
else self._client_wrapper.get_timeout(),
282+
retries=0,
283+
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
284+
)
285+
if 200 <= _response.status_code < 300:
286+
return
287+
if _response.status_code == 422:
288+
raise UnprocessableEntityError(
289+
typing.cast(HttpValidationError, construct_type(type_=HttpValidationError, object_=_response.json())) # type: ignore
290+
)
291+
try:
292+
_response_json = _response.json()
293+
except JSONDecodeError:
294+
raise ApiError(status_code=_response.status_code, body=_response.text)
295+
raise ApiError(status_code=_response.status_code, body=_response_json)

src/elevenlabs/base_client.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import httpx
77

8+
from .audio_isolation.client import AsyncAudioIsolationClient, AudioIsolationClient
89
from .audio_native.client import AsyncAudioNativeClient, AudioNativeClient
910
from .chapters.client import AsyncChaptersClient, ChaptersClient
1011
from .core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
@@ -84,6 +85,7 @@ def __init__(
8485
)
8586
self.history = HistoryClient(client_wrapper=self._client_wrapper)
8687
self.text_to_sound_effects = TextToSoundEffectsClient(client_wrapper=self._client_wrapper)
88+
self.audio_isolation = AudioIsolationClient(client_wrapper=self._client_wrapper)
8789
self.samples = SamplesClient(client_wrapper=self._client_wrapper)
8890
self.text_to_speech = TextToSpeechClient(client_wrapper=self._client_wrapper)
8991
self.speech_to_speech = SpeechToSpeechClient(client_wrapper=self._client_wrapper)
@@ -159,6 +161,7 @@ def __init__(
159161
)
160162
self.history = AsyncHistoryClient(client_wrapper=self._client_wrapper)
161163
self.text_to_sound_effects = AsyncTextToSoundEffectsClient(client_wrapper=self._client_wrapper)
164+
self.audio_isolation = AsyncAudioIsolationClient(client_wrapper=self._client_wrapper)
162165
self.samples = AsyncSamplesClient(client_wrapper=self._client_wrapper)
163166
self.text_to_speech = AsyncTextToSpeechClient(client_wrapper=self._client_wrapper)
164167
self.speech_to_speech = AsyncSpeechToSpeechClient(client_wrapper=self._client_wrapper)

src/elevenlabs/core/client_wrapper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def get_headers(self) -> typing.Dict[str, str]:
1717
headers: typing.Dict[str, str] = {
1818
"X-Fern-Language": "Python",
1919
"X-Fern-SDK-Name": "elevenlabs",
20-
"X-Fern-SDK-Version": "v1.3.1",
20+
"X-Fern-SDK-Version": "v1.4.0",
2121
}
2222
if self._api_key is not None:
2323
headers["xi-api-key"] = self._api_key

0 commit comments

Comments
 (0)