Skip to content

Commit

Permalink
chore: release 1.13.2
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] authored Dec 2, 2024
1 parent c940195 commit bc167cb
Show file tree
Hide file tree
Showing 15 changed files with 179 additions and 18 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 = "1.13.1"
version = "1.13.2"
description = ""
readme = "README.md"
authors = []
Expand Down
6 changes: 6 additions & 0 deletions src/elevenlabs/chapters/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,9 @@ def stream_snapshot(
json={
"convert_to_mpeg": convert_to_mpeg,
},
headers={
"content-type": "application/json",
},
request_options=request_options,
omit=OMIT,
)
Expand Down Expand Up @@ -822,6 +825,9 @@ async def main() -> None:
json={
"convert_to_mpeg": convert_to_mpeg,
},
headers={
"content-type": "application/json",
},
request_options=request_options,
omit=OMIT,
)
Expand Down
18 changes: 18 additions & 0 deletions src/elevenlabs/conversational_ai/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@ def create_agent(
),
"name": name,
},
headers={
"content-type": "application/json",
},
request_options=request_options,
omit=OMIT,
)
Expand Down Expand Up @@ -363,6 +366,9 @@ def update_agent(
),
"name": name,
},
headers={
"content-type": "application/json",
},
request_options=request_options,
omit=OMIT,
)
Expand Down Expand Up @@ -693,6 +699,9 @@ def add_agent_secret(
"name": name,
"secret_value": secret_value,
},
headers={
"content-type": "application/json",
},
request_options=request_options,
omit=OMIT,
)
Expand Down Expand Up @@ -1197,6 +1206,9 @@ async def main() -> None:
),
"name": name,
},
headers={
"content-type": "application/json",
},
request_options=request_options,
omit=OMIT,
)
Expand Down Expand Up @@ -1430,6 +1442,9 @@ async def main() -> None:
),
"name": name,
},
headers={
"content-type": "application/json",
},
request_options=request_options,
omit=OMIT,
)
Expand Down Expand Up @@ -1800,6 +1815,9 @@ async def main() -> None:
"name": name,
"secret_value": secret_value,
},
headers={
"content-type": "application/json",
},
request_options=request_options,
omit=OMIT,
)
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 @@ -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.13.1",
"X-Fern-SDK-Version": "1.13.2",
}
if self._api_key is not None:
headers["xi-api-key"] = self._api_key
Expand Down
21 changes: 13 additions & 8 deletions src/elevenlabs/core/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,25 @@ def convert_file_dict_to_httpx_tuples(
return httpx_tuples


def with_content_type(*, file: File, content_type: str) -> File:
""" """
def with_content_type(*, file: File, default_content_type: str) -> File:
"""
This function resolves to the file's content type, if provided, and defaults
to the default_content_type value if not.
"""
if isinstance(file, tuple):
if len(file) == 2:
filename, content = cast(Tuple[Optional[str], FileContent], file) # type: ignore
return (filename, content, content_type)
return (filename, content, default_content_type)
elif len(file) == 3:
filename, content, _ = cast(Tuple[Optional[str], FileContent, Optional[str]], file) # type: ignore
return (filename, content, content_type)
filename, content, file_content_type = cast(Tuple[Optional[str], FileContent, Optional[str]], file) # type: ignore
out_content_type = file_content_type or default_content_type
return (filename, content, out_content_type)
elif len(file) == 4:
filename, content, _, headers = cast( # type: ignore
filename, content, file_content_type, headers = cast( # type: ignore
Tuple[Optional[str], FileContent, Optional[str], Mapping[str, str]], file
)
return (filename, content, content_type, headers)
out_content_type = file_content_type or default_content_type
return (filename, content, out_content_type, headers)
else:
raise ValueError(f"Unexpected tuple length: {len(file)}")
return (None, file, content_type)
return (None, file, default_content_type)
28 changes: 20 additions & 8 deletions src/elevenlabs/core/http_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,11 @@ def request(
json=json_body,
data=data_body,
content=content,
files=convert_file_dict_to_httpx_tuples(remove_none_from_dict(files))
if (files is not None and files is not omit)
else None,
files=(
convert_file_dict_to_httpx_tuples(remove_omit_from_dict(remove_none_from_dict(files), omit))
if (files is not None and files is not omit)
else None
),
timeout=timeout,
)

Expand Down Expand Up @@ -311,9 +313,11 @@ def stream(
json=json_body,
data=data_body,
content=content,
files=convert_file_dict_to_httpx_tuples(remove_none_from_dict(files))
if (files is not None and files is not omit)
else None,
files=(
convert_file_dict_to_httpx_tuples(remove_omit_from_dict(remove_none_from_dict(files), omit))
if (files is not None and files is not omit)
else None
),
timeout=timeout,
) as stream:
yield stream
Expand Down Expand Up @@ -400,7 +404,11 @@ async def request(
json=json_body,
data=data_body,
content=content,
files=convert_file_dict_to_httpx_tuples(remove_none_from_dict(files)) if files is not None else None,
files=(
convert_file_dict_to_httpx_tuples(remove_omit_from_dict(remove_none_from_dict(files), omit))
if files is not None
else None
),
timeout=timeout,
)

Expand Down Expand Up @@ -481,7 +489,11 @@ async def stream(
json=json_body,
data=data_body,
content=content,
files=convert_file_dict_to_httpx_tuples(remove_none_from_dict(files)) if files is not None else None,
files=(
convert_file_dict_to_httpx_tuples(remove_omit_from_dict(remove_none_from_dict(files), omit))
if files is not None
else None
),
timeout=timeout,
) as stream:
yield stream
6 changes: 6 additions & 0 deletions src/elevenlabs/history/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,9 @@ def download(
"history_item_ids": history_item_ids,
"output_format": output_format,
},
headers={
"content-type": "application/json",
},
request_options=request_options,
omit=OMIT,
)
Expand Down Expand Up @@ -696,6 +699,9 @@ async def main() -> None:
"history_item_ids": history_item_ids,
"output_format": output_format,
},
headers={
"content-type": "application/json",
},
request_options=request_options,
omit=OMIT,
)
Expand Down
24 changes: 24 additions & 0 deletions src/elevenlabs/projects/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,9 @@ def edit_basic_project_info(
"volume_normalization": volume_normalization,
"quality_check_on": quality_check_on,
},
headers={
"content-type": "application/json",
},
request_options=request_options,
omit=OMIT,
)
Expand Down Expand Up @@ -643,6 +646,9 @@ def stream_audio(
json={
"convert_to_mpeg": convert_to_mpeg,
},
headers={
"content-type": "application/json",
},
request_options=request_options,
omit=OMIT,
) as _response:
Expand Down Expand Up @@ -773,6 +779,9 @@ def add_chapter_to_a_project(
"name": name,
"from_url": from_url,
},
headers={
"content-type": "application/json",
},
request_options=request_options,
omit=OMIT,
)
Expand Down Expand Up @@ -853,6 +862,9 @@ def update_pronunciation_dictionaries(
direction="write",
),
},
headers={
"content-type": "application/json",
},
request_options=request_options,
omit=OMIT,
)
Expand Down Expand Up @@ -1290,6 +1302,9 @@ async def main() -> None:
"volume_normalization": volume_normalization,
"quality_check_on": quality_check_on,
},
headers={
"content-type": "application/json",
},
request_options=request_options,
omit=OMIT,
)
Expand Down Expand Up @@ -1554,6 +1569,9 @@ async def stream_audio(
json={
"convert_to_mpeg": convert_to_mpeg,
},
headers={
"content-type": "application/json",
},
request_options=request_options,
omit=OMIT,
) as _response:
Expand Down Expand Up @@ -1700,6 +1718,9 @@ async def main() -> None:
"name": name,
"from_url": from_url,
},
headers={
"content-type": "application/json",
},
request_options=request_options,
omit=OMIT,
)
Expand Down Expand Up @@ -1788,6 +1809,9 @@ async def main() -> None:
direction="write",
),
},
headers={
"content-type": "application/json",
},
request_options=request_options,
omit=OMIT,
)
Expand Down
12 changes: 12 additions & 0 deletions src/elevenlabs/pronunciation_dictionary/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,9 @@ def add_rules_to_the_pronunciation_dictionary(
object_=rules, annotation=typing.Sequence[PronunciationDictionaryRule], direction="write"
),
},
headers={
"content-type": "application/json",
},
request_options=request_options,
omit=OMIT,
)
Expand Down Expand Up @@ -243,6 +246,9 @@ def remove_rules_from_the_pronunciation_dictionary(
json={
"rule_strings": rule_strings,
},
headers={
"content-type": "application/json",
},
request_options=request_options,
omit=OMIT,
)
Expand Down Expand Up @@ -617,6 +623,9 @@ async def main() -> None:
object_=rules, annotation=typing.Sequence[PronunciationDictionaryRule], direction="write"
),
},
headers={
"content-type": "application/json",
},
request_options=request_options,
omit=OMIT,
)
Expand Down Expand Up @@ -696,6 +705,9 @@ async def main() -> None:
json={
"rule_strings": rule_strings,
},
headers={
"content-type": "application/json",
},
request_options=request_options,
omit=OMIT,
)
Expand Down
6 changes: 6 additions & 0 deletions src/elevenlabs/text_to_sound_effects/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ def convert(
"duration_seconds": duration_seconds,
"prompt_influence": prompt_influence,
},
headers={
"content-type": "application/json",
},
request_options=request_options,
omit=OMIT,
) as _response:
Expand Down Expand Up @@ -124,6 +127,9 @@ async def convert(
"duration_seconds": duration_seconds,
"prompt_influence": prompt_influence,
},
headers={
"content-type": "application/json",
},
request_options=request_options,
omit=OMIT,
) as _response:
Expand Down
Loading

0 comments on commit bc167cb

Please sign in to comment.