spitch 1.35.0__tar.gz → 1.37.0__tar.gz
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.
- spitch-1.37.0/.release-please-manifest.json +3 -0
- {spitch-1.35.0 → spitch-1.37.0}/CHANGELOG.md +16 -0
- {spitch-1.35.0 → spitch-1.37.0}/PKG-INFO +83 -12
- {spitch-1.35.0 → spitch-1.37.0}/README.md +82 -11
- {spitch-1.35.0 → spitch-1.37.0}/api.md +11 -11
- {spitch-1.35.0 → spitch-1.37.0}/pyproject.toml +1 -1
- {spitch-1.35.0 → spitch-1.37.0}/src/spitch/_version.py +1 -1
- {spitch-1.35.0 → spitch-1.37.0}/src/spitch/resources/files.py +25 -25
- {spitch-1.35.0 → spitch-1.37.0}/src/spitch/resources/speech.py +11 -7
- {spitch-1.35.0 → spitch-1.37.0}/src/spitch/resources/text.py +10 -10
- {spitch-1.35.0 → spitch-1.37.0}/src/spitch/types/__init__.py +7 -6
- spitch-1.35.0/src/spitch/types/text_tone_mark_response.py → spitch-1.37.0/src/spitch/types/diacritics.py +2 -2
- spitch-1.35.0/src/spitch/types/file_list_response.py → spitch-1.37.0/src/spitch/types/file.py +4 -2
- spitch-1.37.0/src/spitch/types/file_download_response.py +15 -0
- spitch-1.37.0/src/spitch/types/file_usage.py +17 -0
- spitch-1.37.0/src/spitch/types/files.py +14 -0
- {spitch-1.35.0 → spitch-1.37.0}/src/spitch/types/speech_generate_params.py +2 -0
- {spitch-1.35.0 → spitch-1.37.0}/src/spitch/types/speech_transcribe_params.py +1 -1
- spitch-1.35.0/src/spitch/types/speech_transcribe_response.py → spitch-1.37.0/src/spitch/types/transcription.py +2 -2
- spitch-1.35.0/src/spitch/types/text_translate_response.py → spitch-1.37.0/src/spitch/types/translation.py +2 -2
- {spitch-1.35.0 → spitch-1.37.0}/tests/api_resources/test_files.py +37 -37
- {spitch-1.35.0 → spitch-1.37.0}/tests/api_resources/test_speech.py +11 -9
- {spitch-1.35.0 → spitch-1.37.0}/tests/api_resources/test_text.py +13 -13
- spitch-1.35.0/.release-please-manifest.json +0 -3
- spitch-1.35.0/src/spitch/types/file_get_response.py +0 -24
- spitch-1.35.0/src/spitch/types/file_upload_response.py +0 -24
- {spitch-1.35.0 → spitch-1.37.0}/.gitignore +0 -0
- {spitch-1.35.0 → spitch-1.37.0}/CONTRIBUTING.md +0 -0
- {spitch-1.35.0 → spitch-1.37.0}/LICENSE +0 -0
- {spitch-1.35.0 → spitch-1.37.0}/SECURITY.md +0 -0
- {spitch-1.35.0 → spitch-1.37.0}/bin/check-release-environment +0 -0
- {spitch-1.35.0 → spitch-1.37.0}/bin/publish-pypi +0 -0
- {spitch-1.35.0 → spitch-1.37.0}/examples/.keep +0 -0
- {spitch-1.35.0 → spitch-1.37.0}/examples/example.py +0 -0
- {spitch-1.35.0 → spitch-1.37.0}/noxfile.py +0 -0
- {spitch-1.35.0 → spitch-1.37.0}/release-please-config.json +0 -0
- {spitch-1.35.0 → spitch-1.37.0}/requirements-dev.lock +0 -0
- {spitch-1.35.0 → spitch-1.37.0}/requirements.lock +0 -0
- {spitch-1.35.0 → spitch-1.37.0}/src/spitch/__init__.py +0 -0
- {spitch-1.35.0 → spitch-1.37.0}/src/spitch/_base_client.py +0 -0
- {spitch-1.35.0 → spitch-1.37.0}/src/spitch/_client.py +0 -0
- {spitch-1.35.0 → spitch-1.37.0}/src/spitch/_compat.py +0 -0
- {spitch-1.35.0 → spitch-1.37.0}/src/spitch/_constants.py +0 -0
- {spitch-1.35.0 → spitch-1.37.0}/src/spitch/_exceptions.py +0 -0
- {spitch-1.35.0 → spitch-1.37.0}/src/spitch/_files.py +0 -0
- {spitch-1.35.0 → spitch-1.37.0}/src/spitch/_models.py +0 -0
- {spitch-1.35.0 → spitch-1.37.0}/src/spitch/_qs.py +0 -0
- {spitch-1.35.0 → spitch-1.37.0}/src/spitch/_resource.py +0 -0
- {spitch-1.35.0 → spitch-1.37.0}/src/spitch/_response.py +0 -0
- {spitch-1.35.0 → spitch-1.37.0}/src/spitch/_streaming.py +0 -0
- {spitch-1.35.0 → spitch-1.37.0}/src/spitch/_types.py +0 -0
- {spitch-1.35.0 → spitch-1.37.0}/src/spitch/_utils/__init__.py +0 -0
- {spitch-1.35.0 → spitch-1.37.0}/src/spitch/_utils/_compat.py +0 -0
- {spitch-1.35.0 → spitch-1.37.0}/src/spitch/_utils/_datetime_parse.py +0 -0
- {spitch-1.35.0 → spitch-1.37.0}/src/spitch/_utils/_logs.py +0 -0
- {spitch-1.35.0 → spitch-1.37.0}/src/spitch/_utils/_proxy.py +0 -0
- {spitch-1.35.0 → spitch-1.37.0}/src/spitch/_utils/_reflection.py +0 -0
- {spitch-1.35.0 → spitch-1.37.0}/src/spitch/_utils/_resources_proxy.py +0 -0
- {spitch-1.35.0 → spitch-1.37.0}/src/spitch/_utils/_streams.py +0 -0
- {spitch-1.35.0 → spitch-1.37.0}/src/spitch/_utils/_sync.py +0 -0
- {spitch-1.35.0 → spitch-1.37.0}/src/spitch/_utils/_transform.py +0 -0
- {spitch-1.35.0 → spitch-1.37.0}/src/spitch/_utils/_typing.py +0 -0
- {spitch-1.35.0 → spitch-1.37.0}/src/spitch/_utils/_utils.py +0 -0
- {spitch-1.35.0 → spitch-1.37.0}/src/spitch/lib/.keep +0 -0
- {spitch-1.35.0 → spitch-1.37.0}/src/spitch/pagination.py +0 -0
- {spitch-1.35.0 → spitch-1.37.0}/src/spitch/py.typed +0 -0
- {spitch-1.35.0 → spitch-1.37.0}/src/spitch/resources/__init__.py +0 -0
- {spitch-1.35.0 → spitch-1.37.0}/src/spitch/types/file_delete_response.py +0 -0
- {spitch-1.35.0 → spitch-1.37.0}/src/spitch/types/file_download_params.py +0 -0
- {spitch-1.35.0 → spitch-1.37.0}/src/spitch/types/file_list_params.py +0 -0
- {spitch-1.35.0 → spitch-1.37.0}/src/spitch/types/file_upload_params.py +0 -0
- {spitch-1.35.0 → spitch-1.37.0}/src/spitch/types/text_tone_mark_params.py +0 -0
- {spitch-1.35.0 → spitch-1.37.0}/src/spitch/types/text_translate_params.py +0 -0
- {spitch-1.35.0 → spitch-1.37.0}/tests/__init__.py +0 -0
- {spitch-1.35.0 → spitch-1.37.0}/tests/api_resources/__init__.py +0 -0
- {spitch-1.35.0 → spitch-1.37.0}/tests/conftest.py +0 -0
- {spitch-1.35.0 → spitch-1.37.0}/tests/sample_file.txt +0 -0
- {spitch-1.35.0 → spitch-1.37.0}/tests/test_client.py +0 -0
- {spitch-1.35.0 → spitch-1.37.0}/tests/test_deepcopy.py +0 -0
- {spitch-1.35.0 → spitch-1.37.0}/tests/test_extract_files.py +0 -0
- {spitch-1.35.0 → spitch-1.37.0}/tests/test_files.py +0 -0
- {spitch-1.35.0 → spitch-1.37.0}/tests/test_models.py +0 -0
- {spitch-1.35.0 → spitch-1.37.0}/tests/test_qs.py +0 -0
- {spitch-1.35.0 → spitch-1.37.0}/tests/test_required_args.py +0 -0
- {spitch-1.35.0 → spitch-1.37.0}/tests/test_response.py +0 -0
- {spitch-1.35.0 → spitch-1.37.0}/tests/test_streaming.py +0 -0
- {spitch-1.35.0 → spitch-1.37.0}/tests/test_transform.py +0 -0
- {spitch-1.35.0 → spitch-1.37.0}/tests/test_utils/test_datetime_parse.py +0 -0
- {spitch-1.35.0 → spitch-1.37.0}/tests/test_utils/test_proxy.py +0 -0
- {spitch-1.35.0 → spitch-1.37.0}/tests/test_utils/test_typing.py +0 -0
- {spitch-1.35.0 → spitch-1.37.0}/tests/utils.py +0 -0
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.37.0 (2025-10-06)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v1.36.0...v1.37.0](https://github.com/spi-tch/spitch-python/compare/v1.36.0...v1.37.0)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
* **api:** manual updates ([c8f4f39](https://github.com/spi-tch/spitch-python/commit/c8f4f3942e2a9a7a2c3897a81288ab03e9172885))
|
|
10
|
+
|
|
11
|
+
## 1.36.0 (2025-10-06)
|
|
12
|
+
|
|
13
|
+
Full Changelog: [v1.35.0...v1.36.0](https://github.com/spi-tch/spitch-python/compare/v1.35.0...v1.36.0)
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* **api:** manual updates ([813fc60](https://github.com/spi-tch/spitch-python/commit/813fc60ce810fc61aa542eae3a780bce8b21e506))
|
|
18
|
+
|
|
3
19
|
## 1.35.0 (2025-10-06)
|
|
4
20
|
|
|
5
21
|
Full Changelog: [v1.34.0...v1.35.0](https://github.com/spi-tch/spitch-python/compare/v1.34.0...v1.35.0)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: spitch
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.37.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"))
|
|
@@ -34,8 +34,8 @@ client = Spitch(
|
|
|
34
34
|
|
|
35
35
|
response = client.speech.generate(
|
|
36
36
|
language="yo",
|
|
37
|
-
text="
|
|
38
|
-
voice="
|
|
37
|
+
text="Bawo ni, ololufe?",
|
|
38
|
+
voice="femi",
|
|
39
39
|
)
|
|
40
40
|
```
|
|
41
41
|
|
|
@@ -61,8 +61,8 @@ client = AsyncSpitch(
|
|
|
61
61
|
async def main() -> None:
|
|
62
62
|
response = await client.speech.generate(
|
|
63
63
|
language="yo",
|
|
64
|
-
text="
|
|
65
|
-
voice="
|
|
64
|
+
text="Bawo ni, ololufe?",
|
|
65
|
+
voice="femi",
|
|
66
66
|
)
|
|
67
67
|
|
|
68
68
|
|
|
@@ -97,8 +97,8 @@ async def main() -> None:
|
|
|
97
97
|
) as client:
|
|
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
|
|
|
@@ -114,6 +114,77 @@ Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typ
|
|
|
114
114
|
|
|
115
115
|
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`.
|
|
116
116
|
|
|
117
|
+
## Pagination
|
|
118
|
+
|
|
119
|
+
List methods in the Spitch API are paginated.
|
|
120
|
+
|
|
121
|
+
This library provides auto-paginating iterators with each list response, so you do not have to request successive pages manually:
|
|
122
|
+
|
|
123
|
+
```python
|
|
124
|
+
from spitch import Spitch
|
|
125
|
+
|
|
126
|
+
client = Spitch()
|
|
127
|
+
|
|
128
|
+
all_files = []
|
|
129
|
+
# Automatically fetches more pages as needed.
|
|
130
|
+
for file in client.files.list(
|
|
131
|
+
limit=10,
|
|
132
|
+
):
|
|
133
|
+
# Do something with file here
|
|
134
|
+
all_files.append(file)
|
|
135
|
+
print(all_files)
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Or, asynchronously:
|
|
139
|
+
|
|
140
|
+
```python
|
|
141
|
+
import asyncio
|
|
142
|
+
from spitch import AsyncSpitch
|
|
143
|
+
|
|
144
|
+
client = AsyncSpitch()
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
async def main() -> None:
|
|
148
|
+
all_files = []
|
|
149
|
+
# Iterate through items across all pages, issuing requests as needed.
|
|
150
|
+
async for file in client.files.list(
|
|
151
|
+
limit=10,
|
|
152
|
+
):
|
|
153
|
+
all_files.append(file)
|
|
154
|
+
print(all_files)
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
asyncio.run(main())
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
Alternatively, you can use the `.has_next_page()`, `.next_page_info()`, or `.get_next_page()` methods for more granular control working with pages:
|
|
161
|
+
|
|
162
|
+
```python
|
|
163
|
+
first_page = await client.files.list(
|
|
164
|
+
limit=10,
|
|
165
|
+
)
|
|
166
|
+
if first_page.has_next_page():
|
|
167
|
+
print(f"will fetch next page using these details: {first_page.next_page_info()}")
|
|
168
|
+
next_page = await first_page.get_next_page()
|
|
169
|
+
print(f"number of items we just fetched: {len(next_page.items)}")
|
|
170
|
+
|
|
171
|
+
# Remove `await` for non-async usage.
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
Or just work directly with the returned data:
|
|
175
|
+
|
|
176
|
+
```python
|
|
177
|
+
first_page = await client.files.list(
|
|
178
|
+
limit=10,
|
|
179
|
+
)
|
|
180
|
+
|
|
181
|
+
print(f"next page cursor: {first_page.next_cursor}") # => "next page cursor: ..."
|
|
182
|
+
for file in first_page.items:
|
|
183
|
+
print(file.file_id)
|
|
184
|
+
|
|
185
|
+
# Remove `await` for non-async usage.
|
|
186
|
+
```
|
|
187
|
+
|
|
117
188
|
## File uploads
|
|
118
189
|
|
|
119
190
|
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)`.
|
|
@@ -150,7 +221,7 @@ client = Spitch()
|
|
|
150
221
|
try:
|
|
151
222
|
client.speech.generate(
|
|
152
223
|
language="yo",
|
|
153
|
-
text="
|
|
224
|
+
text="Bawo ni, ololufe?",
|
|
154
225
|
voice="sade",
|
|
155
226
|
)
|
|
156
227
|
except spitch.APIConnectionError as e:
|
|
@@ -197,7 +268,7 @@ client = Spitch(
|
|
|
197
268
|
# Or, configure per-request:
|
|
198
269
|
client.with_options(max_retries=5).speech.generate(
|
|
199
270
|
language="yo",
|
|
200
|
-
text="
|
|
271
|
+
text="Bawo ni, ololufe?",
|
|
201
272
|
voice="sade",
|
|
202
273
|
)
|
|
203
274
|
```
|
|
@@ -224,7 +295,7 @@ client = Spitch(
|
|
|
224
295
|
# Override per-request:
|
|
225
296
|
client.with_options(timeout=5.0).speech.generate(
|
|
226
297
|
language="yo",
|
|
227
|
-
text="
|
|
298
|
+
text="Bawo ni, ololufe?",
|
|
228
299
|
voice="sade",
|
|
229
300
|
)
|
|
230
301
|
```
|
|
@@ -267,7 +338,7 @@ from spitch import Spitch
|
|
|
267
338
|
client = Spitch()
|
|
268
339
|
response = client.speech.with_raw_response.generate(
|
|
269
340
|
language="yo",
|
|
270
|
-
text="
|
|
341
|
+
text="Bawo ni, ololufe?",
|
|
271
342
|
voice="sade",
|
|
272
343
|
)
|
|
273
344
|
print(response.headers.get('X-My-Header'))
|
|
@@ -289,7 +360,7 @@ To stream the response body, use `.with_streaming_response` instead, which requi
|
|
|
289
360
|
```python
|
|
290
361
|
with client.speech.with_streaming_response.generate(
|
|
291
362
|
language="yo",
|
|
292
|
-
text="
|
|
363
|
+
text="Bawo ni, ololufe?",
|
|
293
364
|
voice="sade",
|
|
294
365
|
) as response:
|
|
295
366
|
print(response.headers.get("X-My-Header"))
|
|
@@ -3,40 +3,40 @@
|
|
|
3
3
|
Types:
|
|
4
4
|
|
|
5
5
|
```python
|
|
6
|
-
from spitch.types import
|
|
6
|
+
from spitch.types import Transcription
|
|
7
7
|
```
|
|
8
8
|
|
|
9
9
|
Methods:
|
|
10
10
|
|
|
11
11
|
- <code title="post /v1/speech">client.speech.<a href="./src/spitch/resources/speech.py">generate</a>(\*\*<a href="src/spitch/types/speech_generate_params.py">params</a>) -> BinaryAPIResponse</code>
|
|
12
|
-
- <code title="post /v1/transcriptions">client.speech.<a href="./src/spitch/resources/speech.py">transcribe</a>(\*\*<a href="src/spitch/types/speech_transcribe_params.py">params</a>) -> <a href="./src/spitch/types/
|
|
12
|
+
- <code title="post /v1/transcriptions">client.speech.<a href="./src/spitch/resources/speech.py">transcribe</a>(\*\*<a href="src/spitch/types/speech_transcribe_params.py">params</a>) -> <a href="./src/spitch/types/transcription.py">Transcription</a></code>
|
|
13
13
|
|
|
14
14
|
# Text
|
|
15
15
|
|
|
16
16
|
Types:
|
|
17
17
|
|
|
18
18
|
```python
|
|
19
|
-
from spitch.types import
|
|
19
|
+
from spitch.types import Diacritics, Translation
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
Methods:
|
|
23
23
|
|
|
24
|
-
- <code title="post /v1/diacritics">client.text.<a href="./src/spitch/resources/text.py">tone_mark</a>(\*\*<a href="src/spitch/types/text_tone_mark_params.py">params</a>) -> <a href="./src/spitch/types/
|
|
25
|
-
- <code title="post /v1/translate">client.text.<a href="./src/spitch/resources/text.py">translate</a>(\*\*<a href="src/spitch/types/text_translate_params.py">params</a>) -> <a href="./src/spitch/types/
|
|
24
|
+
- <code title="post /v1/diacritics">client.text.<a href="./src/spitch/resources/text.py">tone_mark</a>(\*\*<a href="src/spitch/types/text_tone_mark_params.py">params</a>) -> <a href="./src/spitch/types/diacritics.py">Diacritics</a></code>
|
|
25
|
+
- <code title="post /v1/translate">client.text.<a href="./src/spitch/resources/text.py">translate</a>(\*\*<a href="src/spitch/types/text_translate_params.py">params</a>) -> <a href="./src/spitch/types/translation.py">Translation</a></code>
|
|
26
26
|
|
|
27
27
|
# Files
|
|
28
28
|
|
|
29
29
|
Types:
|
|
30
30
|
|
|
31
31
|
```python
|
|
32
|
-
from spitch.types import
|
|
32
|
+
from spitch.types import File, FileUsage, Files, FileDeleteResponse, FileDownloadResponse
|
|
33
33
|
```
|
|
34
34
|
|
|
35
35
|
Methods:
|
|
36
36
|
|
|
37
|
-
- <code title="get /v1/files">client.files.<a href="./src/spitch/resources/files.py">list</a>(\*\*<a href="src/spitch/types/file_list_params.py">params</a>) -> <a href="./src/spitch/types/
|
|
37
|
+
- <code title="get /v1/files">client.files.<a href="./src/spitch/resources/files.py">list</a>(\*\*<a href="src/spitch/types/file_list_params.py">params</a>) -> <a href="./src/spitch/types/file.py">SyncFilesCursor[File]</a></code>
|
|
38
38
|
- <code title="delete /v1/files/{file_id}">client.files.<a href="./src/spitch/resources/files.py">delete</a>(file_id) -> <a href="./src/spitch/types/file_delete_response.py">FileDeleteResponse</a></code>
|
|
39
|
-
- <code title="get /v1/files/{file_id}/url">client.files.<a href="./src/spitch/resources/files.py">download</a>(file_id, \*\*<a href="src/spitch/types/file_download_params.py">params</a>) ->
|
|
40
|
-
- <code title="get /v1/files/{file_id}">client.files.<a href="./src/spitch/resources/files.py">get</a>(file_id) -> <a href="./src/spitch/types/
|
|
41
|
-
- <code title="post /v1/files">client.files.<a href="./src/spitch/resources/files.py">upload</a>(\*\*<a href="src/spitch/types/file_upload_params.py">params</a>) -> <a href="./src/spitch/types/
|
|
42
|
-
- <code title="get /v1/files:usage">client.files.<a href="./src/spitch/resources/files.py">usage</a>() ->
|
|
39
|
+
- <code title="get /v1/files/{file_id}/url">client.files.<a href="./src/spitch/resources/files.py">download</a>(file_id, \*\*<a href="src/spitch/types/file_download_params.py">params</a>) -> <a href="./src/spitch/types/file_download_response.py">FileDownloadResponse</a></code>
|
|
40
|
+
- <code title="get /v1/files/{file_id}">client.files.<a href="./src/spitch/resources/files.py">get</a>(file_id) -> <a href="./src/spitch/types/file.py">File</a></code>
|
|
41
|
+
- <code title="post /v1/files">client.files.<a href="./src/spitch/resources/files.py">upload</a>(\*\*<a href="src/spitch/types/file_upload_params.py">params</a>) -> <a href="./src/spitch/types/file.py">File</a></code>
|
|
42
|
+
- <code title="get /v1/files:usage">client.files.<a href="./src/spitch/resources/files.py">usage</a>() -> <a href="./src/spitch/types/file_usage.py">FileUsage</a></code>
|
|
@@ -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
|
|