Skip to content

Commit b105f1a

Browse files
(feat): improve comments and use realistic examples
1 parent b034562 commit b105f1a

File tree

25 files changed

+2267
-936
lines changed

25 files changed

+2267
-936
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 = "v1.2.1"
3+
version = "v1.2.2"
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
@@ -16,6 +16,7 @@
1616
ChapterSnapshotsResponse,
1717
ChapterState,
1818
ChapterStatisticsResponse,
19+
CloseConnection,
1920
Currency,
2021
DoDubbingResponse,
2122
DubbingMetadataResponse,
@@ -35,6 +36,7 @@
3536
History,
3637
HistoryItem,
3738
HttpValidationError,
39+
InitializeConnection,
3840
Invoice,
3941
LanguageResponse,
4042
LibraryVoiceResponse,
@@ -103,6 +105,7 @@
103105
PronunciationDictionaryRule_Alias,
104106
PronunciationDictionaryRule_Phoneme,
105107
)
108+
from .text_to_speech import SendMessage
106109
from .version import __version__
107110

108111
__all__ = [
@@ -121,6 +124,7 @@
121124
"ChapterSnapshotsResponse",
122125
"ChapterState",
123126
"ChapterStatisticsResponse",
127+
"CloseConnection",
124128
"Currency",
125129
"DoDubbingResponse",
126130
"DubbingMetadataResponse",
@@ -141,6 +145,7 @@
141145
"History",
142146
"HistoryItem",
143147
"HttpValidationError",
148+
"InitializeConnection",
144149
"Invoice",
145150
"LanguageResponse",
146151
"LibraryVoiceResponse",
@@ -165,6 +170,7 @@
165170
"RecordingResponse",
166171
"RemovePronunciationDictionaryRulesResponseModel",
167172
"ReviewStatus",
173+
"SendMessage",
168174
"SendText",
169175
"Source",
170176
"SpeechHistoryItemResponse",

src/elevenlabs/audio_native/client.py

Lines changed: 74 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ def create(
2727
self,
2828
*,
2929
name: str,
30+
file: core.File,
3031
image: typing.Optional[str] = None,
3132
author: typing.Optional[str] = None,
3233
title: typing.Optional[str] = None,
@@ -36,40 +37,60 @@ def create(
3637
sessionization: typing.Optional[int] = None,
3738
voice_id: typing.Optional[str] = None,
3839
model_id: typing.Optional[str] = None,
39-
file: core.File,
4040
auto_convert: typing.Optional[bool] = None,
4141
request_options: typing.Optional[RequestOptions] = None,
4242
) -> AudioNativeCreateProjectResponseModel:
4343
"""
4444
Creates AudioNative enabled project, optionally starts conversion and returns project id and embeddable html snippet.
4545
46-
Parameters:
47-
- name: str. Project name.
46+
Parameters
47+
----------
48+
name : str
49+
Project name.
50+
51+
file : core.File
52+
See core.File for more documentation
53+
54+
image : typing.Optional[str]
55+
Image URL used in the player. If not provided, default image set in the Player settings is used.
4856
49-
- image: typing.Optional[str]. Image URL used in the player. If not provided, default image set in the Player settings is used.
57+
author : typing.Optional[str]
58+
Author used in the player and inserted at the start of the uploaded article. If not provided, the default author set in the Player settings is used.
5059
51-
- author: typing.Optional[str]. Author used in the player and inserted at the start of the uploaded article. If not provided, the default author set in the Player settings is used.
60+
title : typing.Optional[str]
61+
Title used in the player and inserted at the top of the uploaded article. If not provided, the default title set in the Player settings is used.
5262
53-
- title: typing.Optional[str]. Title used in the player and inserted at the top of the uploaded article. If not provided, the default title set in the Player settings is used.
63+
small : typing.Optional[bool]
64+
Whether to use small player or not. If not provided, default value set in the Player settings is used.
5465
55-
- small: typing.Optional[bool]. Whether to use small player or not. If not provided, default value set in the Player settings is used.
66+
text_color : typing.Optional[str]
67+
Text color used in the player. If not provided, default text color set in the Player settings is used.
5668
57-
- text_color: typing.Optional[str]. Text color used in the player. If not provided, default text color set in the Player settings is used.
69+
background_color : typing.Optional[str]
70+
Background color used in the player. If not provided, default background color set in the Player settings is used.
5871
59-
- background_color: typing.Optional[str]. Background color used in the player. If not provided, default background color set in the Player settings is used.
72+
sessionization : typing.Optional[int]
73+
Specifies for how many minutes to persist the session across page reloads. If not provided, default sessionization set in the Player settings is used.
6074
61-
- sessionization: typing.Optional[int]. Specifies for how many minutes to persist the session across page reloads. If not provided, default sessionization set in the Player settings is used.
75+
voice_id : typing.Optional[str]
76+
Voice ID used to voice the content. If not provided, default voice ID set in the Player settings is used.
6277
63-
- voice_id: typing.Optional[str]. Voice ID used to voice the content. If not provided, default voice ID set in the Player settings is used.
78+
model_id : typing.Optional[str]
79+
TTS Model ID used in the player. If not provided, default model ID set in the Player settings is used.
6480
65-
- model_id: typing.Optional[str]. TTS Model ID used in the player. If not provided, default model ID set in the Player settings is used.
81+
auto_convert : typing.Optional[bool]
82+
Whether to auto convert the project to audio or not.
6683
67-
- file: core.File. See core.File for more documentation
84+
request_options : typing.Optional[RequestOptions]
85+
Request-specific configuration.
6886
69-
- auto_convert: typing.Optional[bool]. Whether to auto convert the project to audio or not.
87+
Returns
88+
-------
89+
AudioNativeCreateProjectResponseModel
90+
Successful Response
7091
71-
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
72-
---
92+
Examples
93+
--------
7394
from elevenlabs.client import ElevenLabs
7495
7596
client = ElevenLabs(
@@ -159,6 +180,7 @@ async def create(
159180
self,
160181
*,
161182
name: str,
183+
file: core.File,
162184
image: typing.Optional[str] = None,
163185
author: typing.Optional[str] = None,
164186
title: typing.Optional[str] = None,
@@ -168,40 +190,60 @@ async def create(
168190
sessionization: typing.Optional[int] = None,
169191
voice_id: typing.Optional[str] = None,
170192
model_id: typing.Optional[str] = None,
171-
file: core.File,
172193
auto_convert: typing.Optional[bool] = None,
173194
request_options: typing.Optional[RequestOptions] = None,
174195
) -> AudioNativeCreateProjectResponseModel:
175196
"""
176197
Creates AudioNative enabled project, optionally starts conversion and returns project id and embeddable html snippet.
177198
178-
Parameters:
179-
- name: str. Project name.
199+
Parameters
200+
----------
201+
name : str
202+
Project name.
203+
204+
file : core.File
205+
See core.File for more documentation
206+
207+
image : typing.Optional[str]
208+
Image URL used in the player. If not provided, default image set in the Player settings is used.
180209
181-
- image: typing.Optional[str]. Image URL used in the player. If not provided, default image set in the Player settings is used.
210+
author : typing.Optional[str]
211+
Author used in the player and inserted at the start of the uploaded article. If not provided, the default author set in the Player settings is used.
182212
183-
- author: typing.Optional[str]. Author used in the player and inserted at the start of the uploaded article. If not provided, the default author set in the Player settings is used.
213+
title : typing.Optional[str]
214+
Title used in the player and inserted at the top of the uploaded article. If not provided, the default title set in the Player settings is used.
184215
185-
- title: typing.Optional[str]. Title used in the player and inserted at the top of the uploaded article. If not provided, the default title set in the Player settings is used.
216+
small : typing.Optional[bool]
217+
Whether to use small player or not. If not provided, default value set in the Player settings is used.
186218
187-
- small: typing.Optional[bool]. Whether to use small player or not. If not provided, default value set in the Player settings is used.
219+
text_color : typing.Optional[str]
220+
Text color used in the player. If not provided, default text color set in the Player settings is used.
188221
189-
- text_color: typing.Optional[str]. Text color used in the player. If not provided, default text color set in the Player settings is used.
222+
background_color : typing.Optional[str]
223+
Background color used in the player. If not provided, default background color set in the Player settings is used.
190224
191-
- background_color: typing.Optional[str]. Background color used in the player. If not provided, default background color set in the Player settings is used.
225+
sessionization : typing.Optional[int]
226+
Specifies for how many minutes to persist the session across page reloads. If not provided, default sessionization set in the Player settings is used.
192227
193-
- sessionization: typing.Optional[int]. Specifies for how many minutes to persist the session across page reloads. If not provided, default sessionization set in the Player settings is used.
228+
voice_id : typing.Optional[str]
229+
Voice ID used to voice the content. If not provided, default voice ID set in the Player settings is used.
194230
195-
- voice_id: typing.Optional[str]. Voice ID used to voice the content. If not provided, default voice ID set in the Player settings is used.
231+
model_id : typing.Optional[str]
232+
TTS Model ID used in the player. If not provided, default model ID set in the Player settings is used.
196233
197-
- model_id: typing.Optional[str]. TTS Model ID used in the player. If not provided, default model ID set in the Player settings is used.
234+
auto_convert : typing.Optional[bool]
235+
Whether to auto convert the project to audio or not.
198236
199-
- file: core.File. See core.File for more documentation
237+
request_options : typing.Optional[RequestOptions]
238+
Request-specific configuration.
200239
201-
- auto_convert: typing.Optional[bool]. Whether to auto convert the project to audio or not.
240+
Returns
241+
-------
242+
AudioNativeCreateProjectResponseModel
243+
Successful Response
202244
203-
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
204-
---
245+
Examples
246+
--------
205247
from elevenlabs.client import AsyncElevenLabs
206248
207249
client = AsyncElevenLabs(

src/elevenlabs/base_client.py

Lines changed: 40 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,32 @@ class BaseElevenLabs:
2626
"""
2727
Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propogate to these functions.
2828
29-
Parameters:
30-
- base_url: typing.Optional[str]. The base url to use for requests from the client.
29+
Parameters
30+
----------
31+
base_url : typing.Optional[str]
32+
The base url to use for requests from the client.
3133
32-
- environment: ElevenLabsEnvironment. The environment to use for requests from the client. from .environment import ElevenLabsEnvironment
34+
environment : ElevenLabsEnvironment
35+
The environment to use for requests from the client. from .environment import ElevenLabsEnvironment
3336
34-
Defaults to ElevenLabsEnvironment.PRODUCTION
3537
36-
- api_key: typing.Optional[str].
3738
38-
- timeout: typing.Optional[float]. The timeout to be used, in seconds, for requests by default the timeout is 60 seconds, unless a custom httpx client is used, in which case a default is not set.
39+
Defaults to ElevenLabsEnvironment.PRODUCTION
3940
40-
- follow_redirects: typing.Optional[bool]. Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in.
4141
42-
- httpx_client: typing.Optional[httpx.Client]. The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration.
43-
---
42+
43+
api_key : typing.Optional[str]
44+
timeout : typing.Optional[float]
45+
The timeout to be used, in seconds, for requests by default the timeout is 60 seconds, unless a custom httpx client is used, in which case a default is not set.
46+
47+
follow_redirects : typing.Optional[bool]
48+
Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in.
49+
50+
httpx_client : typing.Optional[httpx.Client]
51+
The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration.
52+
53+
Examples
54+
--------
4455
from elevenlabs.client import ElevenLabs
4556
4657
client = ElevenLabs(
@@ -88,21 +99,32 @@ class AsyncBaseElevenLabs:
8899
"""
89100
Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propogate to these functions.
90101
91-
Parameters:
92-
- base_url: typing.Optional[str]. The base url to use for requests from the client.
102+
Parameters
103+
----------
104+
base_url : typing.Optional[str]
105+
The base url to use for requests from the client.
106+
107+
environment : ElevenLabsEnvironment
108+
The environment to use for requests from the client. from .environment import ElevenLabsEnvironment
109+
110+
111+
112+
Defaults to ElevenLabsEnvironment.PRODUCTION
93113
94-
- environment: ElevenLabsEnvironment. The environment to use for requests from the client. from .environment import ElevenLabsEnvironment
95114
96-
Defaults to ElevenLabsEnvironment.PRODUCTION
97115
98-
- api_key: typing.Optional[str].
116+
api_key : typing.Optional[str]
117+
timeout : typing.Optional[float]
118+
The timeout to be used, in seconds, for requests by default the timeout is 60 seconds, unless a custom httpx client is used, in which case a default is not set.
99119
100-
- timeout: typing.Optional[float]. The timeout to be used, in seconds, for requests by default the timeout is 60 seconds, unless a custom httpx client is used, in which case a default is not set.
120+
follow_redirects : typing.Optional[bool]
121+
Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in.
101122
102-
- follow_redirects: typing.Optional[bool]. Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in.
123+
httpx_client : typing.Optional[httpx.AsyncClient]
124+
The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration.
103125
104-
- httpx_client: typing.Optional[httpx.AsyncClient]. The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration.
105-
---
126+
Examples
127+
--------
106128
from elevenlabs.client import AsyncElevenLabs
107129
108130
client = AsyncElevenLabs(

0 commit comments

Comments
 (0)