Skip to content

Commit bc167cb

Browse files
chore: release 1.13.2
1 parent c940195 commit bc167cb

File tree

15 files changed

+179
-18
lines changed

15 files changed

+179
-18
lines changed

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 = "1.13.1"
3+
version = "1.13.2"
44
description = ""
55
readme = "README.md"
66
authors = []

src/elevenlabs/chapters/client.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,9 @@ def stream_snapshot(
385385
json={
386386
"convert_to_mpeg": convert_to_mpeg,
387387
},
388+
headers={
389+
"content-type": "application/json",
390+
},
388391
request_options=request_options,
389392
omit=OMIT,
390393
)
@@ -822,6 +825,9 @@ async def main() -> None:
822825
json={
823826
"convert_to_mpeg": convert_to_mpeg,
824827
},
828+
headers={
829+
"content-type": "application/json",
830+
},
825831
request_options=request_options,
826832
omit=OMIT,
827833
)

src/elevenlabs/conversational_ai/client.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,9 @@ def create_agent(
154154
),
155155
"name": name,
156156
},
157+
headers={
158+
"content-type": "application/json",
159+
},
157160
request_options=request_options,
158161
omit=OMIT,
159162
)
@@ -363,6 +366,9 @@ def update_agent(
363366
),
364367
"name": name,
365368
},
369+
headers={
370+
"content-type": "application/json",
371+
},
366372
request_options=request_options,
367373
omit=OMIT,
368374
)
@@ -693,6 +699,9 @@ def add_agent_secret(
693699
"name": name,
694700
"secret_value": secret_value,
695701
},
702+
headers={
703+
"content-type": "application/json",
704+
},
696705
request_options=request_options,
697706
omit=OMIT,
698707
)
@@ -1197,6 +1206,9 @@ async def main() -> None:
11971206
),
11981207
"name": name,
11991208
},
1209+
headers={
1210+
"content-type": "application/json",
1211+
},
12001212
request_options=request_options,
12011213
omit=OMIT,
12021214
)
@@ -1430,6 +1442,9 @@ async def main() -> None:
14301442
),
14311443
"name": name,
14321444
},
1445+
headers={
1446+
"content-type": "application/json",
1447+
},
14331448
request_options=request_options,
14341449
omit=OMIT,
14351450
)
@@ -1800,6 +1815,9 @@ async def main() -> None:
18001815
"name": name,
18011816
"secret_value": secret_value,
18021817
},
1818+
headers={
1819+
"content-type": "application/json",
1820+
},
18031821
request_options=request_options,
18041822
omit=OMIT,
18051823
)

src/elevenlabs/core/client_wrapper.py

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

src/elevenlabs/core/file.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,20 +43,25 @@ def convert_file_dict_to_httpx_tuples(
4343
return httpx_tuples
4444

4545

46-
def with_content_type(*, file: File, content_type: str) -> File:
47-
""" """
46+
def with_content_type(*, file: File, default_content_type: str) -> File:
47+
"""
48+
This function resolves to the file's content type, if provided, and defaults
49+
to the default_content_type value if not.
50+
"""
4851
if isinstance(file, tuple):
4952
if len(file) == 2:
5053
filename, content = cast(Tuple[Optional[str], FileContent], file) # type: ignore
51-
return (filename, content, content_type)
54+
return (filename, content, default_content_type)
5255
elif len(file) == 3:
53-
filename, content, _ = cast(Tuple[Optional[str], FileContent, Optional[str]], file) # type: ignore
54-
return (filename, content, content_type)
56+
filename, content, file_content_type = cast(Tuple[Optional[str], FileContent, Optional[str]], file) # type: ignore
57+
out_content_type = file_content_type or default_content_type
58+
return (filename, content, out_content_type)
5559
elif len(file) == 4:
56-
filename, content, _, headers = cast( # type: ignore
60+
filename, content, file_content_type, headers = cast( # type: ignore
5761
Tuple[Optional[str], FileContent, Optional[str], Mapping[str, str]], file
5862
)
59-
return (filename, content, content_type, headers)
63+
out_content_type = file_content_type or default_content_type
64+
return (filename, content, out_content_type, headers)
6065
else:
6166
raise ValueError(f"Unexpected tuple length: {len(file)}")
62-
return (None, file, content_type)
67+
return (None, file, default_content_type)

src/elevenlabs/core/http_client.py

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,11 @@ def request(
227227
json=json_body,
228228
data=data_body,
229229
content=content,
230-
files=convert_file_dict_to_httpx_tuples(remove_none_from_dict(files))
231-
if (files is not None and files is not omit)
232-
else None,
230+
files=(
231+
convert_file_dict_to_httpx_tuples(remove_omit_from_dict(remove_none_from_dict(files), omit))
232+
if (files is not None and files is not omit)
233+
else None
234+
),
233235
timeout=timeout,
234236
)
235237

@@ -311,9 +313,11 @@ def stream(
311313
json=json_body,
312314
data=data_body,
313315
content=content,
314-
files=convert_file_dict_to_httpx_tuples(remove_none_from_dict(files))
315-
if (files is not None and files is not omit)
316-
else None,
316+
files=(
317+
convert_file_dict_to_httpx_tuples(remove_omit_from_dict(remove_none_from_dict(files), omit))
318+
if (files is not None and files is not omit)
319+
else None
320+
),
317321
timeout=timeout,
318322
) as stream:
319323
yield stream
@@ -400,7 +404,11 @@ async def request(
400404
json=json_body,
401405
data=data_body,
402406
content=content,
403-
files=convert_file_dict_to_httpx_tuples(remove_none_from_dict(files)) if files is not None else None,
407+
files=(
408+
convert_file_dict_to_httpx_tuples(remove_omit_from_dict(remove_none_from_dict(files), omit))
409+
if files is not None
410+
else None
411+
),
404412
timeout=timeout,
405413
)
406414

@@ -481,7 +489,11 @@ async def stream(
481489
json=json_body,
482490
data=data_body,
483491
content=content,
484-
files=convert_file_dict_to_httpx_tuples(remove_none_from_dict(files)) if files is not None else None,
492+
files=(
493+
convert_file_dict_to_httpx_tuples(remove_omit_from_dict(remove_none_from_dict(files), omit))
494+
if files is not None
495+
else None
496+
),
485497
timeout=timeout,
486498
) as stream:
487499
yield stream

src/elevenlabs/history/client.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,9 @@ def download(
326326
"history_item_ids": history_item_ids,
327327
"output_format": output_format,
328328
},
329+
headers={
330+
"content-type": "application/json",
331+
},
329332
request_options=request_options,
330333
omit=OMIT,
331334
)
@@ -696,6 +699,9 @@ async def main() -> None:
696699
"history_item_ids": history_item_ids,
697700
"output_format": output_format,
698701
},
702+
headers={
703+
"content-type": "application/json",
704+
},
699705
request_options=request_options,
700706
omit=OMIT,
701707
)

src/elevenlabs/projects/client.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,9 @@ def edit_basic_project_info(
403403
"volume_normalization": volume_normalization,
404404
"quality_check_on": quality_check_on,
405405
},
406+
headers={
407+
"content-type": "application/json",
408+
},
406409
request_options=request_options,
407410
omit=OMIT,
408411
)
@@ -643,6 +646,9 @@ def stream_audio(
643646
json={
644647
"convert_to_mpeg": convert_to_mpeg,
645648
},
649+
headers={
650+
"content-type": "application/json",
651+
},
646652
request_options=request_options,
647653
omit=OMIT,
648654
) as _response:
@@ -773,6 +779,9 @@ def add_chapter_to_a_project(
773779
"name": name,
774780
"from_url": from_url,
775781
},
782+
headers={
783+
"content-type": "application/json",
784+
},
776785
request_options=request_options,
777786
omit=OMIT,
778787
)
@@ -853,6 +862,9 @@ def update_pronunciation_dictionaries(
853862
direction="write",
854863
),
855864
},
865+
headers={
866+
"content-type": "application/json",
867+
},
856868
request_options=request_options,
857869
omit=OMIT,
858870
)
@@ -1290,6 +1302,9 @@ async def main() -> None:
12901302
"volume_normalization": volume_normalization,
12911303
"quality_check_on": quality_check_on,
12921304
},
1305+
headers={
1306+
"content-type": "application/json",
1307+
},
12931308
request_options=request_options,
12941309
omit=OMIT,
12951310
)
@@ -1554,6 +1569,9 @@ async def stream_audio(
15541569
json={
15551570
"convert_to_mpeg": convert_to_mpeg,
15561571
},
1572+
headers={
1573+
"content-type": "application/json",
1574+
},
15571575
request_options=request_options,
15581576
omit=OMIT,
15591577
) as _response:
@@ -1700,6 +1718,9 @@ async def main() -> None:
17001718
"name": name,
17011719
"from_url": from_url,
17021720
},
1721+
headers={
1722+
"content-type": "application/json",
1723+
},
17031724
request_options=request_options,
17041725
omit=OMIT,
17051726
)
@@ -1788,6 +1809,9 @@ async def main() -> None:
17881809
direction="write",
17891810
),
17901811
},
1812+
headers={
1813+
"content-type": "application/json",
1814+
},
17911815
request_options=request_options,
17921816
omit=OMIT,
17931817
)

src/elevenlabs/pronunciation_dictionary/client.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,9 @@ def add_rules_to_the_pronunciation_dictionary(
172172
object_=rules, annotation=typing.Sequence[PronunciationDictionaryRule], direction="write"
173173
),
174174
},
175+
headers={
176+
"content-type": "application/json",
177+
},
175178
request_options=request_options,
176179
omit=OMIT,
177180
)
@@ -243,6 +246,9 @@ def remove_rules_from_the_pronunciation_dictionary(
243246
json={
244247
"rule_strings": rule_strings,
245248
},
249+
headers={
250+
"content-type": "application/json",
251+
},
246252
request_options=request_options,
247253
omit=OMIT,
248254
)
@@ -617,6 +623,9 @@ async def main() -> None:
617623
object_=rules, annotation=typing.Sequence[PronunciationDictionaryRule], direction="write"
618624
),
619625
},
626+
headers={
627+
"content-type": "application/json",
628+
},
620629
request_options=request_options,
621630
omit=OMIT,
622631
)
@@ -696,6 +705,9 @@ async def main() -> None:
696705
json={
697706
"rule_strings": rule_strings,
698707
},
708+
headers={
709+
"content-type": "application/json",
710+
},
699711
request_options=request_options,
700712
omit=OMIT,
701713
)

src/elevenlabs/text_to_sound_effects/client.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ def convert(
5656
"duration_seconds": duration_seconds,
5757
"prompt_influence": prompt_influence,
5858
},
59+
headers={
60+
"content-type": "application/json",
61+
},
5962
request_options=request_options,
6063
omit=OMIT,
6164
) as _response:
@@ -124,6 +127,9 @@ async def convert(
124127
"duration_seconds": duration_seconds,
125128
"prompt_influence": prompt_influence,
126129
},
130+
headers={
131+
"content-type": "application/json",
132+
},
127133
request_options=request_options,
128134
omit=OMIT,
129135
) as _response:

0 commit comments

Comments
 (0)