spitch 1.35.0__py3-none-any.whl → 1.36.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of spitch might be problematic. Click here for more details.
- spitch/_version.py +1 -1
- spitch/resources/files.py +25 -25
- spitch/resources/speech.py +7 -7
- spitch/resources/text.py +10 -10
- spitch/types/__init__.py +7 -6
- spitch/types/{text_tone_mark_response.py → diacritics.py} +2 -2
- spitch/types/{file_get_response.py → file.py} +4 -2
- spitch/types/file_download_response.py +15 -0
- spitch/types/file_usage.py +17 -0
- spitch/types/files.py +14 -0
- spitch/types/speech_transcribe_params.py +1 -1
- spitch/types/{speech_transcribe_response.py → transcription.py} +2 -2
- spitch/types/{text_translate_response.py → translation.py} +2 -2
- {spitch-1.35.0.dist-info → spitch-1.36.0.dist-info}/METADATA +83 -12
- {spitch-1.35.0.dist-info → spitch-1.36.0.dist-info}/RECORD +17 -16
- spitch/types/file_list_response.py +0 -24
- spitch/types/file_upload_response.py +0 -24
- {spitch-1.35.0.dist-info → spitch-1.36.0.dist-info}/WHEEL +0 -0
- {spitch-1.35.0.dist-info → spitch-1.36.0.dist-info}/licenses/LICENSE +0 -0
spitch/_version.py
CHANGED
spitch/resources/files.py
CHANGED
|
@@ -19,11 +19,11 @@ from .._response import (
|
|
|
19
19
|
async_to_streamed_response_wrapper,
|
|
20
20
|
)
|
|
21
21
|
from ..pagination import SyncFilesCursor, AsyncFilesCursor
|
|
22
|
+
from ..types.file import File
|
|
22
23
|
from .._base_client import AsyncPaginator, make_request_options
|
|
23
|
-
from ..types.
|
|
24
|
-
from ..types.file_list_response import FileListResponse
|
|
24
|
+
from ..types.file_usage import FileUsage
|
|
25
25
|
from ..types.file_delete_response import FileDeleteResponse
|
|
26
|
-
from ..types.
|
|
26
|
+
from ..types.file_download_response import FileDownloadResponse
|
|
27
27
|
|
|
28
28
|
__all__ = ["FilesResource", "AsyncFilesResource"]
|
|
29
29
|
|
|
@@ -60,7 +60,7 @@ class FilesResource(SyncAPIResource):
|
|
|
60
60
|
extra_query: Query | None = None,
|
|
61
61
|
extra_body: Body | None = None,
|
|
62
62
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
63
|
-
) -> SyncFilesCursor[
|
|
63
|
+
) -> SyncFilesCursor[File]:
|
|
64
64
|
"""
|
|
65
65
|
Get Files
|
|
66
66
|
|
|
@@ -75,7 +75,7 @@ class FilesResource(SyncAPIResource):
|
|
|
75
75
|
"""
|
|
76
76
|
return self._get_api_list(
|
|
77
77
|
"/v1/files",
|
|
78
|
-
page=SyncFilesCursor[
|
|
78
|
+
page=SyncFilesCursor[File],
|
|
79
79
|
options=make_request_options(
|
|
80
80
|
extra_headers=extra_headers,
|
|
81
81
|
extra_query=extra_query,
|
|
@@ -90,7 +90,7 @@ class FilesResource(SyncAPIResource):
|
|
|
90
90
|
file_list_params.FileListParams,
|
|
91
91
|
),
|
|
92
92
|
),
|
|
93
|
-
model=
|
|
93
|
+
model=File,
|
|
94
94
|
)
|
|
95
95
|
|
|
96
96
|
def delete(
|
|
@@ -137,7 +137,7 @@ class FilesResource(SyncAPIResource):
|
|
|
137
137
|
extra_query: Query | None = None,
|
|
138
138
|
extra_body: Body | None = None,
|
|
139
139
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
140
|
-
) ->
|
|
140
|
+
) -> FileDownloadResponse:
|
|
141
141
|
"""
|
|
142
142
|
Download File
|
|
143
143
|
|
|
@@ -161,7 +161,7 @@ class FilesResource(SyncAPIResource):
|
|
|
161
161
|
timeout=timeout,
|
|
162
162
|
query=maybe_transform({"ttl": ttl}, file_download_params.FileDownloadParams),
|
|
163
163
|
),
|
|
164
|
-
cast_to=
|
|
164
|
+
cast_to=FileDownloadResponse,
|
|
165
165
|
)
|
|
166
166
|
|
|
167
167
|
def get(
|
|
@@ -174,7 +174,7 @@ class FilesResource(SyncAPIResource):
|
|
|
174
174
|
extra_query: Query | None = None,
|
|
175
175
|
extra_body: Body | None = None,
|
|
176
176
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
177
|
-
) ->
|
|
177
|
+
) -> File:
|
|
178
178
|
"""
|
|
179
179
|
Get File
|
|
180
180
|
|
|
@@ -194,7 +194,7 @@ class FilesResource(SyncAPIResource):
|
|
|
194
194
|
options=make_request_options(
|
|
195
195
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
196
196
|
),
|
|
197
|
-
cast_to=
|
|
197
|
+
cast_to=File,
|
|
198
198
|
)
|
|
199
199
|
|
|
200
200
|
def upload(
|
|
@@ -207,7 +207,7 @@ class FilesResource(SyncAPIResource):
|
|
|
207
207
|
extra_query: Query | None = None,
|
|
208
208
|
extra_body: Body | None = None,
|
|
209
209
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
210
|
-
) ->
|
|
210
|
+
) -> File:
|
|
211
211
|
"""
|
|
212
212
|
Upload File
|
|
213
213
|
|
|
@@ -233,7 +233,7 @@ class FilesResource(SyncAPIResource):
|
|
|
233
233
|
options=make_request_options(
|
|
234
234
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
235
235
|
),
|
|
236
|
-
cast_to=
|
|
236
|
+
cast_to=File,
|
|
237
237
|
)
|
|
238
238
|
|
|
239
239
|
def usage(
|
|
@@ -245,14 +245,14 @@ class FilesResource(SyncAPIResource):
|
|
|
245
245
|
extra_query: Query | None = None,
|
|
246
246
|
extra_body: Body | None = None,
|
|
247
247
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
248
|
-
) ->
|
|
248
|
+
) -> FileUsage:
|
|
249
249
|
"""Get Usage"""
|
|
250
250
|
return self._get(
|
|
251
251
|
"/v1/files:usage",
|
|
252
252
|
options=make_request_options(
|
|
253
253
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
254
254
|
),
|
|
255
|
-
cast_to=
|
|
255
|
+
cast_to=FileUsage,
|
|
256
256
|
)
|
|
257
257
|
|
|
258
258
|
|
|
@@ -288,7 +288,7 @@ class AsyncFilesResource(AsyncAPIResource):
|
|
|
288
288
|
extra_query: Query | None = None,
|
|
289
289
|
extra_body: Body | None = None,
|
|
290
290
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
291
|
-
) -> AsyncPaginator[
|
|
291
|
+
) -> AsyncPaginator[File, AsyncFilesCursor[File]]:
|
|
292
292
|
"""
|
|
293
293
|
Get Files
|
|
294
294
|
|
|
@@ -303,7 +303,7 @@ class AsyncFilesResource(AsyncAPIResource):
|
|
|
303
303
|
"""
|
|
304
304
|
return self._get_api_list(
|
|
305
305
|
"/v1/files",
|
|
306
|
-
page=AsyncFilesCursor[
|
|
306
|
+
page=AsyncFilesCursor[File],
|
|
307
307
|
options=make_request_options(
|
|
308
308
|
extra_headers=extra_headers,
|
|
309
309
|
extra_query=extra_query,
|
|
@@ -318,7 +318,7 @@ class AsyncFilesResource(AsyncAPIResource):
|
|
|
318
318
|
file_list_params.FileListParams,
|
|
319
319
|
),
|
|
320
320
|
),
|
|
321
|
-
model=
|
|
321
|
+
model=File,
|
|
322
322
|
)
|
|
323
323
|
|
|
324
324
|
async def delete(
|
|
@@ -365,7 +365,7 @@ class AsyncFilesResource(AsyncAPIResource):
|
|
|
365
365
|
extra_query: Query | None = None,
|
|
366
366
|
extra_body: Body | None = None,
|
|
367
367
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
368
|
-
) ->
|
|
368
|
+
) -> FileDownloadResponse:
|
|
369
369
|
"""
|
|
370
370
|
Download File
|
|
371
371
|
|
|
@@ -389,7 +389,7 @@ class AsyncFilesResource(AsyncAPIResource):
|
|
|
389
389
|
timeout=timeout,
|
|
390
390
|
query=await async_maybe_transform({"ttl": ttl}, file_download_params.FileDownloadParams),
|
|
391
391
|
),
|
|
392
|
-
cast_to=
|
|
392
|
+
cast_to=FileDownloadResponse,
|
|
393
393
|
)
|
|
394
394
|
|
|
395
395
|
async def get(
|
|
@@ -402,7 +402,7 @@ class AsyncFilesResource(AsyncAPIResource):
|
|
|
402
402
|
extra_query: Query | None = None,
|
|
403
403
|
extra_body: Body | None = None,
|
|
404
404
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
405
|
-
) ->
|
|
405
|
+
) -> File:
|
|
406
406
|
"""
|
|
407
407
|
Get File
|
|
408
408
|
|
|
@@ -422,7 +422,7 @@ class AsyncFilesResource(AsyncAPIResource):
|
|
|
422
422
|
options=make_request_options(
|
|
423
423
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
424
424
|
),
|
|
425
|
-
cast_to=
|
|
425
|
+
cast_to=File,
|
|
426
426
|
)
|
|
427
427
|
|
|
428
428
|
async def upload(
|
|
@@ -435,7 +435,7 @@ class AsyncFilesResource(AsyncAPIResource):
|
|
|
435
435
|
extra_query: Query | None = None,
|
|
436
436
|
extra_body: Body | None = None,
|
|
437
437
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
438
|
-
) ->
|
|
438
|
+
) -> File:
|
|
439
439
|
"""
|
|
440
440
|
Upload File
|
|
441
441
|
|
|
@@ -461,7 +461,7 @@ class AsyncFilesResource(AsyncAPIResource):
|
|
|
461
461
|
options=make_request_options(
|
|
462
462
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
463
463
|
),
|
|
464
|
-
cast_to=
|
|
464
|
+
cast_to=File,
|
|
465
465
|
)
|
|
466
466
|
|
|
467
467
|
async def usage(
|
|
@@ -473,14 +473,14 @@ class AsyncFilesResource(AsyncAPIResource):
|
|
|
473
473
|
extra_query: Query | None = None,
|
|
474
474
|
extra_body: Body | None = None,
|
|
475
475
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
476
|
-
) ->
|
|
476
|
+
) -> FileUsage:
|
|
477
477
|
"""Get Usage"""
|
|
478
478
|
return await self._get(
|
|
479
479
|
"/v1/files:usage",
|
|
480
480
|
options=make_request_options(
|
|
481
481
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
482
482
|
),
|
|
483
|
-
cast_to=
|
|
483
|
+
cast_to=FileUsage,
|
|
484
484
|
)
|
|
485
485
|
|
|
486
486
|
|
spitch/resources/speech.py
CHANGED
|
@@ -27,7 +27,7 @@ from .._response import (
|
|
|
27
27
|
async_to_custom_streamed_response_wrapper,
|
|
28
28
|
)
|
|
29
29
|
from .._base_client import make_request_options
|
|
30
|
-
from ..types.
|
|
30
|
+
from ..types.transcription import Transcription
|
|
31
31
|
|
|
32
32
|
__all__ = ["SpeechResource", "AsyncSpeechResource"]
|
|
33
33
|
|
|
@@ -124,7 +124,7 @@ class SpeechResource(SyncAPIResource):
|
|
|
124
124
|
*,
|
|
125
125
|
language: Literal["yo", "en", "ha", "ig", "am"],
|
|
126
126
|
content: Optional[FileTypes] | Omit = omit,
|
|
127
|
-
model: Optional[Literal["mansa_v1", "legacy"]] | Omit = omit,
|
|
127
|
+
model: Optional[Literal["mansa_v1", "legacy", "human"]] | Omit = omit,
|
|
128
128
|
special_words: Optional[str] | Omit = omit,
|
|
129
129
|
timestamp: Optional[Literal["sentence", "word", "none"]] | Omit = omit,
|
|
130
130
|
url: Optional[str] | Omit = omit,
|
|
@@ -134,7 +134,7 @@ class SpeechResource(SyncAPIResource):
|
|
|
134
134
|
extra_query: Query | None = None,
|
|
135
135
|
extra_body: Body | None = None,
|
|
136
136
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
137
|
-
) ->
|
|
137
|
+
) -> Transcription:
|
|
138
138
|
"""
|
|
139
139
|
Transcribe
|
|
140
140
|
|
|
@@ -169,7 +169,7 @@ class SpeechResource(SyncAPIResource):
|
|
|
169
169
|
options=make_request_options(
|
|
170
170
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
171
171
|
),
|
|
172
|
-
cast_to=
|
|
172
|
+
cast_to=Transcription,
|
|
173
173
|
)
|
|
174
174
|
|
|
175
175
|
|
|
@@ -265,7 +265,7 @@ class AsyncSpeechResource(AsyncAPIResource):
|
|
|
265
265
|
*,
|
|
266
266
|
language: Literal["yo", "en", "ha", "ig", "am"],
|
|
267
267
|
content: Optional[FileTypes] | Omit = omit,
|
|
268
|
-
model: Optional[Literal["mansa_v1", "legacy"]] | Omit = omit,
|
|
268
|
+
model: Optional[Literal["mansa_v1", "legacy", "human"]] | Omit = omit,
|
|
269
269
|
special_words: Optional[str] | Omit = omit,
|
|
270
270
|
timestamp: Optional[Literal["sentence", "word", "none"]] | Omit = omit,
|
|
271
271
|
url: Optional[str] | Omit = omit,
|
|
@@ -275,7 +275,7 @@ class AsyncSpeechResource(AsyncAPIResource):
|
|
|
275
275
|
extra_query: Query | None = None,
|
|
276
276
|
extra_body: Body | None = None,
|
|
277
277
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
278
|
-
) ->
|
|
278
|
+
) -> Transcription:
|
|
279
279
|
"""
|
|
280
280
|
Transcribe
|
|
281
281
|
|
|
@@ -310,7 +310,7 @@ class AsyncSpeechResource(AsyncAPIResource):
|
|
|
310
310
|
options=make_request_options(
|
|
311
311
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
312
312
|
),
|
|
313
|
-
cast_to=
|
|
313
|
+
cast_to=Transcription,
|
|
314
314
|
)
|
|
315
315
|
|
|
316
316
|
|
spitch/resources/text.py
CHANGED
|
@@ -18,8 +18,8 @@ from .._response import (
|
|
|
18
18
|
async_to_streamed_response_wrapper,
|
|
19
19
|
)
|
|
20
20
|
from .._base_client import make_request_options
|
|
21
|
-
from ..types.
|
|
22
|
-
from ..types.
|
|
21
|
+
from ..types.diacritics import Diacritics
|
|
22
|
+
from ..types.translation import Translation
|
|
23
23
|
|
|
24
24
|
__all__ = ["TextResource", "AsyncTextResource"]
|
|
25
25
|
|
|
@@ -55,7 +55,7 @@ class TextResource(SyncAPIResource):
|
|
|
55
55
|
extra_query: Query | None = None,
|
|
56
56
|
extra_body: Body | None = None,
|
|
57
57
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
58
|
-
) ->
|
|
58
|
+
) -> Diacritics:
|
|
59
59
|
"""
|
|
60
60
|
Tone Mark
|
|
61
61
|
|
|
@@ -80,7 +80,7 @@ class TextResource(SyncAPIResource):
|
|
|
80
80
|
options=make_request_options(
|
|
81
81
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
82
82
|
),
|
|
83
|
-
cast_to=
|
|
83
|
+
cast_to=Diacritics,
|
|
84
84
|
)
|
|
85
85
|
|
|
86
86
|
def translate(
|
|
@@ -95,7 +95,7 @@ class TextResource(SyncAPIResource):
|
|
|
95
95
|
extra_query: Query | None = None,
|
|
96
96
|
extra_body: Body | None = None,
|
|
97
97
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
98
|
-
) ->
|
|
98
|
+
) -> Translation:
|
|
99
99
|
"""
|
|
100
100
|
Translate
|
|
101
101
|
|
|
@@ -121,7 +121,7 @@ class TextResource(SyncAPIResource):
|
|
|
121
121
|
options=make_request_options(
|
|
122
122
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
123
123
|
),
|
|
124
|
-
cast_to=
|
|
124
|
+
cast_to=Translation,
|
|
125
125
|
)
|
|
126
126
|
|
|
127
127
|
|
|
@@ -156,7 +156,7 @@ class AsyncTextResource(AsyncAPIResource):
|
|
|
156
156
|
extra_query: Query | None = None,
|
|
157
157
|
extra_body: Body | None = None,
|
|
158
158
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
159
|
-
) ->
|
|
159
|
+
) -> Diacritics:
|
|
160
160
|
"""
|
|
161
161
|
Tone Mark
|
|
162
162
|
|
|
@@ -181,7 +181,7 @@ class AsyncTextResource(AsyncAPIResource):
|
|
|
181
181
|
options=make_request_options(
|
|
182
182
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
183
183
|
),
|
|
184
|
-
cast_to=
|
|
184
|
+
cast_to=Diacritics,
|
|
185
185
|
)
|
|
186
186
|
|
|
187
187
|
async def translate(
|
|
@@ -196,7 +196,7 @@ class AsyncTextResource(AsyncAPIResource):
|
|
|
196
196
|
extra_query: Query | None = None,
|
|
197
197
|
extra_body: Body | None = None,
|
|
198
198
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
199
|
-
) ->
|
|
199
|
+
) -> Translation:
|
|
200
200
|
"""
|
|
201
201
|
Translate
|
|
202
202
|
|
|
@@ -222,7 +222,7 @@ class AsyncTextResource(AsyncAPIResource):
|
|
|
222
222
|
options=make_request_options(
|
|
223
223
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
224
224
|
),
|
|
225
|
-
cast_to=
|
|
225
|
+
cast_to=Translation,
|
|
226
226
|
)
|
|
227
227
|
|
|
228
228
|
|
spitch/types/__init__.py
CHANGED
|
@@ -2,17 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
+
from .file import File as File
|
|
6
|
+
from .files import Files as Files
|
|
7
|
+
from .diacritics import Diacritics as Diacritics
|
|
8
|
+
from .file_usage import FileUsage as FileUsage
|
|
9
|
+
from .translation import Translation as Translation
|
|
10
|
+
from .transcription import Transcription as Transcription
|
|
5
11
|
from .file_list_params import FileListParams as FileListParams
|
|
6
|
-
from .file_get_response import FileGetResponse as FileGetResponse
|
|
7
|
-
from .file_list_response import FileListResponse as FileListResponse
|
|
8
12
|
from .file_upload_params import FileUploadParams as FileUploadParams
|
|
9
13
|
from .file_delete_response import FileDeleteResponse as FileDeleteResponse
|
|
10
14
|
from .file_download_params import FileDownloadParams as FileDownloadParams
|
|
11
|
-
from .file_upload_response import FileUploadResponse as FileUploadResponse
|
|
12
15
|
from .text_tone_mark_params import TextToneMarkParams as TextToneMarkParams
|
|
13
16
|
from .text_translate_params import TextTranslateParams as TextTranslateParams
|
|
17
|
+
from .file_download_response import FileDownloadResponse as FileDownloadResponse
|
|
14
18
|
from .speech_generate_params import SpeechGenerateParams as SpeechGenerateParams
|
|
15
|
-
from .text_tone_mark_response import TextToneMarkResponse as TextToneMarkResponse
|
|
16
|
-
from .text_translate_response import TextTranslateResponse as TextTranslateResponse
|
|
17
19
|
from .speech_transcribe_params import SpeechTranscribeParams as SpeechTranscribeParams
|
|
18
|
-
from .speech_transcribe_response import SpeechTranscribeResponse as SpeechTranscribeResponse
|
|
@@ -5,10 +5,10 @@ from datetime import datetime
|
|
|
5
5
|
|
|
6
6
|
from .._models import BaseModel
|
|
7
7
|
|
|
8
|
-
__all__ = ["
|
|
8
|
+
__all__ = ["File"]
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
class
|
|
11
|
+
class File(BaseModel):
|
|
12
12
|
category: Optional[str] = None
|
|
13
13
|
|
|
14
14
|
content_type: Optional[str] = None
|
|
@@ -22,3 +22,5 @@ class FileGetResponse(BaseModel):
|
|
|
22
22
|
size_bytes: Optional[int] = None
|
|
23
23
|
|
|
24
24
|
status: str
|
|
25
|
+
|
|
26
|
+
uploaded_by: Optional[str] = None
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from datetime import datetime
|
|
4
|
+
|
|
5
|
+
from .._models import BaseModel
|
|
6
|
+
|
|
7
|
+
__all__ = ["FileDownloadResponse"]
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class FileDownloadResponse(BaseModel):
|
|
11
|
+
expires_at: datetime
|
|
12
|
+
|
|
13
|
+
file_id: str
|
|
14
|
+
|
|
15
|
+
url: str
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from .._models import BaseModel
|
|
4
|
+
|
|
5
|
+
__all__ = ["FileUsage"]
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class FileUsage(BaseModel):
|
|
9
|
+
num_files: int
|
|
10
|
+
|
|
11
|
+
total: str
|
|
12
|
+
|
|
13
|
+
total_bytes: int
|
|
14
|
+
|
|
15
|
+
used: str
|
|
16
|
+
|
|
17
|
+
used_bytes: int
|
spitch/types/files.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing import List, Optional
|
|
4
|
+
|
|
5
|
+
from .file import File
|
|
6
|
+
from .._models import BaseModel
|
|
7
|
+
|
|
8
|
+
__all__ = ["Files"]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class Files(BaseModel):
|
|
12
|
+
items: List[File]
|
|
13
|
+
|
|
14
|
+
next_cursor: Optional[str] = None
|
|
@@ -4,7 +4,7 @@ from typing import List, Optional
|
|
|
4
4
|
|
|
5
5
|
from .._models import BaseModel
|
|
6
6
|
|
|
7
|
-
__all__ = ["
|
|
7
|
+
__all__ = ["Transcription", "Timestamp"]
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
class Timestamp(BaseModel):
|
|
@@ -15,7 +15,7 @@ class Timestamp(BaseModel):
|
|
|
15
15
|
text: str
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
class
|
|
18
|
+
class Transcription(BaseModel):
|
|
19
19
|
request_id: str
|
|
20
20
|
|
|
21
21
|
text: str
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: spitch
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.36.0
|
|
4
4
|
Summary: The official Python library for the spitch API
|
|
5
5
|
Project-URL: Homepage, https://github.com/spi-tch/spitch-python
|
|
6
6
|
Project-URL: Repository, https://github.com/spi-tch/spitch-python
|
|
@@ -70,8 +70,8 @@ client = Spitch(
|
|
|
70
70
|
|
|
71
71
|
response = client.speech.generate(
|
|
72
72
|
language="yo",
|
|
73
|
-
text="
|
|
74
|
-
voice="
|
|
73
|
+
text="Bawo ni, ololufe?",
|
|
74
|
+
voice="femi",
|
|
75
75
|
)
|
|
76
76
|
```
|
|
77
77
|
|
|
@@ -97,8 +97,8 @@ client = AsyncSpitch(
|
|
|
97
97
|
async def main() -> None:
|
|
98
98
|
response = await client.speech.generate(
|
|
99
99
|
language="yo",
|
|
100
|
-
text="
|
|
101
|
-
voice="
|
|
100
|
+
text="Bawo ni, ololufe?",
|
|
101
|
+
voice="femi",
|
|
102
102
|
)
|
|
103
103
|
|
|
104
104
|
|
|
@@ -133,8 +133,8 @@ async def main() -> None:
|
|
|
133
133
|
) as client:
|
|
134
134
|
response = await client.speech.generate(
|
|
135
135
|
language="yo",
|
|
136
|
-
text="
|
|
137
|
-
voice="
|
|
136
|
+
text="Bawo ni, ololufe?",
|
|
137
|
+
voice="femi",
|
|
138
138
|
)
|
|
139
139
|
|
|
140
140
|
|
|
@@ -150,6 +150,77 @@ Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typ
|
|
|
150
150
|
|
|
151
151
|
Typed requests and responses provide autocomplete and documentation within your editor. If you would like to see type errors in VS Code to help catch bugs earlier, set `python.analysis.typeCheckingMode` to `basic`.
|
|
152
152
|
|
|
153
|
+
## Pagination
|
|
154
|
+
|
|
155
|
+
List methods in the Spitch API are paginated.
|
|
156
|
+
|
|
157
|
+
This library provides auto-paginating iterators with each list response, so you do not have to request successive pages manually:
|
|
158
|
+
|
|
159
|
+
```python
|
|
160
|
+
from spitch import Spitch
|
|
161
|
+
|
|
162
|
+
client = Spitch()
|
|
163
|
+
|
|
164
|
+
all_files = []
|
|
165
|
+
# Automatically fetches more pages as needed.
|
|
166
|
+
for file in client.files.list(
|
|
167
|
+
limit=10,
|
|
168
|
+
):
|
|
169
|
+
# Do something with file here
|
|
170
|
+
all_files.append(file)
|
|
171
|
+
print(all_files)
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
Or, asynchronously:
|
|
175
|
+
|
|
176
|
+
```python
|
|
177
|
+
import asyncio
|
|
178
|
+
from spitch import AsyncSpitch
|
|
179
|
+
|
|
180
|
+
client = AsyncSpitch()
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
async def main() -> None:
|
|
184
|
+
all_files = []
|
|
185
|
+
# Iterate through items across all pages, issuing requests as needed.
|
|
186
|
+
async for file in client.files.list(
|
|
187
|
+
limit=10,
|
|
188
|
+
):
|
|
189
|
+
all_files.append(file)
|
|
190
|
+
print(all_files)
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
asyncio.run(main())
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
Alternatively, you can use the `.has_next_page()`, `.next_page_info()`, or `.get_next_page()` methods for more granular control working with pages:
|
|
197
|
+
|
|
198
|
+
```python
|
|
199
|
+
first_page = await client.files.list(
|
|
200
|
+
limit=10,
|
|
201
|
+
)
|
|
202
|
+
if first_page.has_next_page():
|
|
203
|
+
print(f"will fetch next page using these details: {first_page.next_page_info()}")
|
|
204
|
+
next_page = await first_page.get_next_page()
|
|
205
|
+
print(f"number of items we just fetched: {len(next_page.items)}")
|
|
206
|
+
|
|
207
|
+
# Remove `await` for non-async usage.
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
Or just work directly with the returned data:
|
|
211
|
+
|
|
212
|
+
```python
|
|
213
|
+
first_page = await client.files.list(
|
|
214
|
+
limit=10,
|
|
215
|
+
)
|
|
216
|
+
|
|
217
|
+
print(f"next page cursor: {first_page.next_cursor}") # => "next page cursor: ..."
|
|
218
|
+
for file in first_page.items:
|
|
219
|
+
print(file.file_id)
|
|
220
|
+
|
|
221
|
+
# Remove `await` for non-async usage.
|
|
222
|
+
```
|
|
223
|
+
|
|
153
224
|
## File uploads
|
|
154
225
|
|
|
155
226
|
Request parameters that correspond to file uploads can be passed as `bytes`, or a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance or a tuple of `(filename, contents, media type)`.
|
|
@@ -186,7 +257,7 @@ client = Spitch()
|
|
|
186
257
|
try:
|
|
187
258
|
client.speech.generate(
|
|
188
259
|
language="yo",
|
|
189
|
-
text="
|
|
260
|
+
text="Bawo ni, ololufe?",
|
|
190
261
|
voice="sade",
|
|
191
262
|
)
|
|
192
263
|
except spitch.APIConnectionError as e:
|
|
@@ -233,7 +304,7 @@ client = Spitch(
|
|
|
233
304
|
# Or, configure per-request:
|
|
234
305
|
client.with_options(max_retries=5).speech.generate(
|
|
235
306
|
language="yo",
|
|
236
|
-
text="
|
|
307
|
+
text="Bawo ni, ololufe?",
|
|
237
308
|
voice="sade",
|
|
238
309
|
)
|
|
239
310
|
```
|
|
@@ -260,7 +331,7 @@ client = Spitch(
|
|
|
260
331
|
# Override per-request:
|
|
261
332
|
client.with_options(timeout=5.0).speech.generate(
|
|
262
333
|
language="yo",
|
|
263
|
-
text="
|
|
334
|
+
text="Bawo ni, ololufe?",
|
|
264
335
|
voice="sade",
|
|
265
336
|
)
|
|
266
337
|
```
|
|
@@ -303,7 +374,7 @@ from spitch import Spitch
|
|
|
303
374
|
client = Spitch()
|
|
304
375
|
response = client.speech.with_raw_response.generate(
|
|
305
376
|
language="yo",
|
|
306
|
-
text="
|
|
377
|
+
text="Bawo ni, ololufe?",
|
|
307
378
|
voice="sade",
|
|
308
379
|
)
|
|
309
380
|
print(response.headers.get('X-My-Header'))
|
|
@@ -325,7 +396,7 @@ To stream the response body, use `.with_streaming_response` instead, which requi
|
|
|
325
396
|
```python
|
|
326
397
|
with client.speech.with_streaming_response.generate(
|
|
327
398
|
language="yo",
|
|
328
|
-
text="
|
|
399
|
+
text="Bawo ni, ololufe?",
|
|
329
400
|
voice="sade",
|
|
330
401
|
) as response:
|
|
331
402
|
print(response.headers.get("X-My-Header"))
|
|
@@ -11,7 +11,7 @@ spitch/_resource.py,sha256=TLFPcOOmtxZOQLh3XCNPB_BdrQpp0MIYoKoH52aRAu8,1100
|
|
|
11
11
|
spitch/_response.py,sha256=-1LLK1wjPW3Hcro9NXjf_SnPRArU1ozdctNIStvxbWo,28690
|
|
12
12
|
spitch/_streaming.py,sha256=5SpId2EIfF8Ee8UUYmJxqgHUGP1ZdHCUHhHCdNJREFA,10100
|
|
13
13
|
spitch/_types.py,sha256=oa5CdZaglGw0wrxxpdWxeoliiTfNpce300esw52GnGk,7260
|
|
14
|
-
spitch/_version.py,sha256=
|
|
14
|
+
spitch/_version.py,sha256=RZwew2YnMeT6o_1a_8not6xDC8mOCEewIJN0QgZlchQ,159
|
|
15
15
|
spitch/pagination.py,sha256=XQaAXcd1OtYzc7zqwCJLQVqFMkC0W-1-0njeSyxT88A,1312
|
|
16
16
|
spitch/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
17
17
|
spitch/_utils/__init__.py,sha256=WhaZJLzT8oCtvdIvbs8gyd6emLYa4usodcqgcpFiciU,2259
|
|
@@ -28,25 +28,26 @@ spitch/_utils/_typing.py,sha256=RCxAvYzuEtYsURpRlnfcWi7jSOpli7zWiWiljTVjVOE,4123
|
|
|
28
28
|
spitch/_utils/_utils.py,sha256=0dDqauUbVZEXV0NVl7Bwu904Wwo5eyFCZpQThhFNhyA,12253
|
|
29
29
|
spitch/lib/.keep,sha256=wuNrz-5SXo3jJaJOJgz4vFHM41YH_g20F5cRQo0vLes,224
|
|
30
30
|
spitch/resources/__init__.py,sha256=oUfkZqMUtVuaZj1l1YuWwDDcfCTFMs89K1-DNgM89VY,1413
|
|
31
|
-
spitch/resources/files.py,sha256=
|
|
32
|
-
spitch/resources/speech.py,sha256=
|
|
33
|
-
spitch/resources/text.py,sha256=
|
|
34
|
-
spitch/types/__init__.py,sha256=
|
|
31
|
+
spitch/resources/files.py,sha256=wslju1bXne3gIRBBLQs49BQwAQhARvF1JGTemGtkcNI,21492
|
|
32
|
+
spitch/resources/speech.py,sha256=St9JAlDjPWDHsX-Ui59p0G_q7_7AwbBnuFy5JcYUS9c,13124
|
|
33
|
+
spitch/resources/text.py,sha256=jPOwxYWoqDUWvbmYlYsMJiZLDy4-C_gIzhnvsbY3p94,9555
|
|
34
|
+
spitch/types/__init__.py,sha256=716oGh0nu8qXtnA8yGH5Hj8VDYSnVKm93pYAFwdO0E0,1079
|
|
35
|
+
spitch/types/diacritics.py,sha256=btOCAZTQ5qLjN78nCb7kyfJeBeBKW4nXlA9T8hsVquE,211
|
|
36
|
+
spitch/types/file.py,sha256=xRfk8t2q7YhQFzhjL8S1EHImdFWwXGIBiUhDDw1Tytk,477
|
|
35
37
|
spitch/types/file_delete_response.py,sha256=r4OwDVrG4BGSEdqYyr7iPpaPzon5pm5Wx61KIRZk1zY,255
|
|
36
38
|
spitch/types/file_download_params.py,sha256=tCiwTeSSbPuniZXdiOQll7Bdc2enBp9yJD-D9SpeEqg,262
|
|
37
|
-
spitch/types/
|
|
39
|
+
spitch/types/file_download_response.py,sha256=OeO6JIFo97dLZcL8iTtazGU1PVZy1rp5VVa5w6d8DHg,284
|
|
38
40
|
spitch/types/file_list_params.py,sha256=FrWZhMUC38sGkBtdQKateTyStVuMOz90x5AHtkoZnzk,373
|
|
39
|
-
spitch/types/file_list_response.py,sha256=XVKUhsHoAI4cx99FndC-_qWSAlH9xNBUwe9mitl6qqE,462
|
|
40
41
|
spitch/types/file_upload_params.py,sha256=5LSsvz7ptuELm5MosWotXpgsBf-Tz_ox1ys9HLx-Sts,317
|
|
41
|
-
spitch/types/
|
|
42
|
+
spitch/types/file_usage.py,sha256=dXrqkDjvq-VECYaMVUL1wL3xS4Nkej7y7AVm5_DU4IE,267
|
|
43
|
+
spitch/types/files.py,sha256=FkNfexYBP3Ug4klnbGbGQTtXj6DC9y4Akbhd78ijb-c,285
|
|
42
44
|
spitch/types/speech_generate_params.py,sha256=m5FQnPfVxcikB5UJTn-2WjttOP5tJ8BMO0LbGPktMe0,939
|
|
43
|
-
spitch/types/speech_transcribe_params.py,sha256=
|
|
44
|
-
spitch/types/speech_transcribe_response.py,sha256=SjqMDTT_VPvN8H7P_be33vlhRBSiLhehTIrNrYOMeIk,415
|
|
45
|
+
spitch/types/speech_transcribe_params.py,sha256=fAVwTfPRR4aLzcu4Y8qrmKXESemnWJIdnyhyVcR3W20,613
|
|
45
46
|
spitch/types/text_tone_mark_params.py,sha256=MEnWzcSjPT_Z_8Mio96LgwYbx2BngG5By-MoeSt0Sms,355
|
|
46
|
-
spitch/types/text_tone_mark_response.py,sha256=AtLA2N7tzhxzuTYxS3PwJfPgjGQxIlgTZmTzIUdxKMA,231
|
|
47
47
|
spitch/types/text_translate_params.py,sha256=skEeG7oTZUSl_gugnqL4Mb7HE_pEFhKNygZPTvci2hA,416
|
|
48
|
-
spitch/types/
|
|
49
|
-
spitch
|
|
50
|
-
spitch-1.
|
|
51
|
-
spitch-1.
|
|
52
|
-
spitch-1.
|
|
48
|
+
spitch/types/transcription.py,sha256=SrbWIwItrt-FdPUPV8PofYTxzLCiwxg7Ya4QsKE1PoY,393
|
|
49
|
+
spitch/types/translation.py,sha256=ICtp42meKFR_CvfW5mSmy3Y0az8SuIhdDi3BAfnWs8k,213
|
|
50
|
+
spitch-1.36.0.dist-info/METADATA,sha256=wMm0MZSCvfxMOS1VM0pskhkarW7FrhmEuWc-1Y6km04,15962
|
|
51
|
+
spitch-1.36.0.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
|
|
52
|
+
spitch-1.36.0.dist-info/licenses/LICENSE,sha256=C0lDWY-no8IxmnqzQA9BA7Z8jeh_bogVPfeWSgeDDcc,11336
|
|
53
|
+
spitch-1.36.0.dist-info/RECORD,,
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
-
|
|
3
|
-
from typing import Optional
|
|
4
|
-
from datetime import datetime
|
|
5
|
-
|
|
6
|
-
from .._models import BaseModel
|
|
7
|
-
|
|
8
|
-
__all__ = ["FileListResponse"]
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
class FileListResponse(BaseModel):
|
|
12
|
-
category: Optional[str] = None
|
|
13
|
-
|
|
14
|
-
content_type: Optional[str] = None
|
|
15
|
-
|
|
16
|
-
created_at: datetime
|
|
17
|
-
|
|
18
|
-
file_id: str
|
|
19
|
-
|
|
20
|
-
original_name: Optional[str] = None
|
|
21
|
-
|
|
22
|
-
size_bytes: Optional[int] = None
|
|
23
|
-
|
|
24
|
-
status: str
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
-
|
|
3
|
-
from typing import Optional
|
|
4
|
-
from datetime import datetime
|
|
5
|
-
|
|
6
|
-
from .._models import BaseModel
|
|
7
|
-
|
|
8
|
-
__all__ = ["FileUploadResponse"]
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
class FileUploadResponse(BaseModel):
|
|
12
|
-
category: Optional[str] = None
|
|
13
|
-
|
|
14
|
-
content_type: Optional[str] = None
|
|
15
|
-
|
|
16
|
-
created_at: datetime
|
|
17
|
-
|
|
18
|
-
file_id: str
|
|
19
|
-
|
|
20
|
-
original_name: Optional[str] = None
|
|
21
|
-
|
|
22
|
-
size_bytes: Optional[int] = None
|
|
23
|
-
|
|
24
|
-
status: str
|
|
File without changes
|
|
File without changes
|