spitch 1.13.0__py3-none-any.whl → 1.15.1__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/_base_client.py +1 -1
- spitch/_compat.py +5 -3
- spitch/_models.py +11 -8
- spitch/_types.py +4 -2
- spitch/_utils/__init__.py +1 -0
- spitch/_utils/_sync.py +40 -50
- spitch/_utils/_transform.py +12 -2
- spitch/_utils/_utils.py +17 -0
- spitch/_version.py +1 -1
- spitch/resources/speech.py +36 -2
- spitch/types/speech_generate_params.py +20 -1
- spitch/types/speech_transcribe_response.py +1 -1
- {spitch-1.13.0.dist-info → spitch-1.15.1.dist-info}/METADATA +7 -11
- {spitch-1.13.0.dist-info → spitch-1.15.1.dist-info}/RECORD +16 -17
- {spitch-1.13.0.dist-info → spitch-1.15.1.dist-info}/WHEEL +1 -1
- spitch/types/speech_transcibe_params.py +0 -18
- {spitch-1.13.0.dist-info → spitch-1.15.1.dist-info}/licenses/LICENSE +0 -0
spitch/_base_client.py
CHANGED
|
@@ -1575,7 +1575,7 @@ class AsyncAPIClient(BaseClient[httpx.AsyncClient, AsyncStream[Any]]):
|
|
|
1575
1575
|
except Exception as err:
|
|
1576
1576
|
log.debug("Encountered Exception", exc_info=True)
|
|
1577
1577
|
|
|
1578
|
-
if
|
|
1578
|
+
if remaining_retries > 0:
|
|
1579
1579
|
return await self._retry_request(
|
|
1580
1580
|
input_options,
|
|
1581
1581
|
cast_to,
|
spitch/_compat.py
CHANGED
|
@@ -2,7 +2,7 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
from typing import TYPE_CHECKING, Any, Union, Generic, TypeVar, Callable, cast, overload
|
|
4
4
|
from datetime import date, datetime
|
|
5
|
-
from typing_extensions import Self
|
|
5
|
+
from typing_extensions import Self, Literal
|
|
6
6
|
|
|
7
7
|
import pydantic
|
|
8
8
|
from pydantic.fields import FieldInfo
|
|
@@ -133,13 +133,15 @@ def model_json(model: pydantic.BaseModel, *, indent: int | None = None) -> str:
|
|
|
133
133
|
def model_dump(
|
|
134
134
|
model: pydantic.BaseModel,
|
|
135
135
|
*,
|
|
136
|
-
exclude: IncEx = None,
|
|
136
|
+
exclude: IncEx | None = None,
|
|
137
137
|
exclude_unset: bool = False,
|
|
138
138
|
exclude_defaults: bool = False,
|
|
139
139
|
warnings: bool = True,
|
|
140
|
+
mode: Literal["json", "python"] = "python",
|
|
140
141
|
) -> dict[str, Any]:
|
|
141
|
-
if PYDANTIC_V2:
|
|
142
|
+
if PYDANTIC_V2 or hasattr(model, "model_dump"):
|
|
142
143
|
return model.model_dump(
|
|
144
|
+
mode=mode,
|
|
143
145
|
exclude=exclude,
|
|
144
146
|
exclude_unset=exclude_unset,
|
|
145
147
|
exclude_defaults=exclude_defaults,
|
spitch/_models.py
CHANGED
|
@@ -37,6 +37,7 @@ from ._utils import (
|
|
|
37
37
|
PropertyInfo,
|
|
38
38
|
is_list,
|
|
39
39
|
is_given,
|
|
40
|
+
json_safe,
|
|
40
41
|
lru_cache,
|
|
41
42
|
is_mapping,
|
|
42
43
|
parse_date,
|
|
@@ -176,7 +177,7 @@ class BaseModel(pydantic.BaseModel):
|
|
|
176
177
|
# Based on https://github.com/samuelcolvin/pydantic/issues/1168#issuecomment-817742836.
|
|
177
178
|
@classmethod
|
|
178
179
|
@override
|
|
179
|
-
def construct(
|
|
180
|
+
def construct( # pyright: ignore[reportIncompatibleMethodOverride]
|
|
180
181
|
cls: Type[ModelT],
|
|
181
182
|
_fields_set: set[str] | None = None,
|
|
182
183
|
**values: object,
|
|
@@ -248,8 +249,8 @@ class BaseModel(pydantic.BaseModel):
|
|
|
248
249
|
self,
|
|
249
250
|
*,
|
|
250
251
|
mode: Literal["json", "python"] | str = "python",
|
|
251
|
-
include: IncEx = None,
|
|
252
|
-
exclude: IncEx = None,
|
|
252
|
+
include: IncEx | None = None,
|
|
253
|
+
exclude: IncEx | None = None,
|
|
253
254
|
by_alias: bool = False,
|
|
254
255
|
exclude_unset: bool = False,
|
|
255
256
|
exclude_defaults: bool = False,
|
|
@@ -279,8 +280,8 @@ class BaseModel(pydantic.BaseModel):
|
|
|
279
280
|
Returns:
|
|
280
281
|
A dictionary representation of the model.
|
|
281
282
|
"""
|
|
282
|
-
if mode
|
|
283
|
-
raise ValueError("mode
|
|
283
|
+
if mode not in {"json", "python"}:
|
|
284
|
+
raise ValueError("mode must be either 'json' or 'python'")
|
|
284
285
|
if round_trip != False:
|
|
285
286
|
raise ValueError("round_trip is only supported in Pydantic v2")
|
|
286
287
|
if warnings != True:
|
|
@@ -289,7 +290,7 @@ class BaseModel(pydantic.BaseModel):
|
|
|
289
290
|
raise ValueError("context is only supported in Pydantic v2")
|
|
290
291
|
if serialize_as_any != False:
|
|
291
292
|
raise ValueError("serialize_as_any is only supported in Pydantic v2")
|
|
292
|
-
|
|
293
|
+
dumped = super().dict( # pyright: ignore[reportDeprecated]
|
|
293
294
|
include=include,
|
|
294
295
|
exclude=exclude,
|
|
295
296
|
by_alias=by_alias,
|
|
@@ -298,13 +299,15 @@ class BaseModel(pydantic.BaseModel):
|
|
|
298
299
|
exclude_none=exclude_none,
|
|
299
300
|
)
|
|
300
301
|
|
|
302
|
+
return cast(dict[str, Any], json_safe(dumped)) if mode == "json" else dumped
|
|
303
|
+
|
|
301
304
|
@override
|
|
302
305
|
def model_dump_json(
|
|
303
306
|
self,
|
|
304
307
|
*,
|
|
305
308
|
indent: int | None = None,
|
|
306
|
-
include: IncEx = None,
|
|
307
|
-
exclude: IncEx = None,
|
|
309
|
+
include: IncEx | None = None,
|
|
310
|
+
exclude: IncEx | None = None,
|
|
308
311
|
by_alias: bool = False,
|
|
309
312
|
exclude_unset: bool = False,
|
|
310
313
|
exclude_defaults: bool = False,
|
spitch/_types.py
CHANGED
|
@@ -16,7 +16,7 @@ from typing import (
|
|
|
16
16
|
Optional,
|
|
17
17
|
Sequence,
|
|
18
18
|
)
|
|
19
|
-
from typing_extensions import Literal, Protocol, TypeAlias, TypedDict, override, runtime_checkable
|
|
19
|
+
from typing_extensions import Set, Literal, Protocol, TypeAlias, TypedDict, override, runtime_checkable
|
|
20
20
|
|
|
21
21
|
import httpx
|
|
22
22
|
import pydantic
|
|
@@ -193,7 +193,9 @@ StrBytesIntFloat = Union[str, bytes, int, float]
|
|
|
193
193
|
|
|
194
194
|
# Note: copied from Pydantic
|
|
195
195
|
# https://github.com/pydantic/pydantic/blob/32ea570bf96e84234d2992e1ddf40ab8a565925a/pydantic/main.py#L49
|
|
196
|
-
IncEx: TypeAlias =
|
|
196
|
+
IncEx: TypeAlias = Union[
|
|
197
|
+
Set[int], Set[str], Mapping[int, Union["IncEx", Literal[True]]], Mapping[str, Union["IncEx", Literal[True]]]
|
|
198
|
+
]
|
|
197
199
|
|
|
198
200
|
PostParser = Callable[[Any], Any]
|
|
199
201
|
|
spitch/_utils/__init__.py
CHANGED
spitch/_utils/_sync.py
CHANGED
|
@@ -1,56 +1,62 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
+
import sys
|
|
4
|
+
import asyncio
|
|
3
5
|
import functools
|
|
4
|
-
|
|
6
|
+
import contextvars
|
|
7
|
+
from typing import Any, TypeVar, Callable, Awaitable
|
|
5
8
|
from typing_extensions import ParamSpec
|
|
6
9
|
|
|
7
|
-
import anyio
|
|
8
|
-
import anyio.to_thread
|
|
9
|
-
|
|
10
|
-
from ._reflection import function_has_argument
|
|
11
|
-
|
|
12
10
|
T_Retval = TypeVar("T_Retval")
|
|
13
11
|
T_ParamSpec = ParamSpec("T_ParamSpec")
|
|
14
12
|
|
|
15
13
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
14
|
+
if sys.version_info >= (3, 9):
|
|
15
|
+
to_thread = asyncio.to_thread
|
|
16
|
+
else:
|
|
17
|
+
# backport of https://docs.python.org/3/library/asyncio-task.html#asyncio.to_thread
|
|
18
|
+
# for Python 3.8 support
|
|
19
|
+
async def to_thread(
|
|
20
|
+
func: Callable[T_ParamSpec, T_Retval], /, *args: T_ParamSpec.args, **kwargs: T_ParamSpec.kwargs
|
|
21
|
+
) -> Any:
|
|
22
|
+
"""Asynchronously run function *func* in a separate thread.
|
|
23
|
+
|
|
24
|
+
Any *args and **kwargs supplied for this function are directly passed
|
|
25
|
+
to *func*. Also, the current :class:`contextvars.Context` is propagated,
|
|
26
|
+
allowing context variables from the main thread to be accessed in the
|
|
27
|
+
separate thread.
|
|
28
|
+
|
|
29
|
+
Returns a coroutine that can be awaited to get the eventual result of *func*.
|
|
30
|
+
"""
|
|
31
|
+
loop = asyncio.events.get_running_loop()
|
|
32
|
+
ctx = contextvars.copy_context()
|
|
33
|
+
func_call = functools.partial(ctx.run, func, *args, **kwargs)
|
|
34
|
+
return await loop.run_in_executor(None, func_call)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
# inspired by `asyncer`, https://github.com/tiangolo/asyncer
|
|
38
|
+
def asyncify(function: Callable[T_ParamSpec, T_Retval]) -> Callable[T_ParamSpec, Awaitable[T_Retval]]:
|
|
23
39
|
"""
|
|
24
40
|
Take a blocking function and create an async one that receives the same
|
|
25
|
-
positional and keyword arguments
|
|
26
|
-
in a
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
autocompletion and inline errors for the arguments of the function called and the
|
|
30
|
-
return value.
|
|
31
|
-
|
|
32
|
-
If the `cancellable` option is enabled and the task waiting for its completion is
|
|
33
|
-
cancelled, the thread will still run its course but its return value (or any raised
|
|
34
|
-
exception) will be ignored.
|
|
41
|
+
positional and keyword arguments. For python version 3.9 and above, it uses
|
|
42
|
+
asyncio.to_thread to run the function in a separate thread. For python version
|
|
43
|
+
3.8, it uses locally defined copy of the asyncio.to_thread function which was
|
|
44
|
+
introduced in python 3.9.
|
|
35
45
|
|
|
36
|
-
|
|
46
|
+
Usage:
|
|
37
47
|
|
|
38
|
-
```
|
|
39
|
-
def
|
|
40
|
-
#
|
|
41
|
-
return
|
|
48
|
+
```python
|
|
49
|
+
def blocking_func(arg1, arg2, kwarg1=None):
|
|
50
|
+
# blocking code
|
|
51
|
+
return result
|
|
42
52
|
|
|
43
53
|
|
|
44
|
-
result =
|
|
45
|
-
print(result)
|
|
54
|
+
result = asyncify(blocking_function)(arg1, arg2, kwarg1=value1)
|
|
46
55
|
```
|
|
47
56
|
|
|
48
57
|
## Arguments
|
|
49
58
|
|
|
50
59
|
`function`: a blocking regular callable (e.g. a function)
|
|
51
|
-
`cancellable`: `True` to allow cancellation of the operation
|
|
52
|
-
`limiter`: capacity limiter to use to limit the total amount of threads running
|
|
53
|
-
(if omitted, the default limiter is used)
|
|
54
60
|
|
|
55
61
|
## Return
|
|
56
62
|
|
|
@@ -60,22 +66,6 @@ def asyncify(
|
|
|
60
66
|
"""
|
|
61
67
|
|
|
62
68
|
async def wrapper(*args: T_ParamSpec.args, **kwargs: T_ParamSpec.kwargs) -> T_Retval:
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
# In `v4.1.0` anyio added the `abandon_on_cancel` argument and deprecated the old
|
|
66
|
-
# `cancellable` argument, so we need to use the new `abandon_on_cancel` to avoid
|
|
67
|
-
# surfacing deprecation warnings.
|
|
68
|
-
if function_has_argument(anyio.to_thread.run_sync, "abandon_on_cancel"):
|
|
69
|
-
return await anyio.to_thread.run_sync(
|
|
70
|
-
partial_f,
|
|
71
|
-
abandon_on_cancel=cancellable,
|
|
72
|
-
limiter=limiter,
|
|
73
|
-
)
|
|
74
|
-
|
|
75
|
-
return await anyio.to_thread.run_sync(
|
|
76
|
-
partial_f,
|
|
77
|
-
cancellable=cancellable,
|
|
78
|
-
limiter=limiter,
|
|
79
|
-
)
|
|
69
|
+
return await to_thread(function, *args, **kwargs)
|
|
80
70
|
|
|
81
71
|
return wrapper
|
spitch/_utils/_transform.py
CHANGED
|
@@ -173,6 +173,11 @@ def _transform_recursive(
|
|
|
173
173
|
# Iterable[T]
|
|
174
174
|
or (is_iterable_type(stripped_type) and is_iterable(data) and not isinstance(data, str))
|
|
175
175
|
):
|
|
176
|
+
# dicts are technically iterable, but it is an iterable on the keys of the dict and is not usually
|
|
177
|
+
# intended as an iterable, so we don't transform it.
|
|
178
|
+
if isinstance(data, dict):
|
|
179
|
+
return cast(object, data)
|
|
180
|
+
|
|
176
181
|
inner_type = extract_type_arg(stripped_type, 0)
|
|
177
182
|
return [_transform_recursive(d, annotation=annotation, inner_type=inner_type) for d in data]
|
|
178
183
|
|
|
@@ -186,7 +191,7 @@ def _transform_recursive(
|
|
|
186
191
|
return data
|
|
187
192
|
|
|
188
193
|
if isinstance(data, pydantic.BaseModel):
|
|
189
|
-
return model_dump(data, exclude_unset=True)
|
|
194
|
+
return model_dump(data, exclude_unset=True, mode="json")
|
|
190
195
|
|
|
191
196
|
annotated_type = _get_annotated_type(annotation)
|
|
192
197
|
if annotated_type is None:
|
|
@@ -311,6 +316,11 @@ async def _async_transform_recursive(
|
|
|
311
316
|
# Iterable[T]
|
|
312
317
|
or (is_iterable_type(stripped_type) and is_iterable(data) and not isinstance(data, str))
|
|
313
318
|
):
|
|
319
|
+
# dicts are technically iterable, but it is an iterable on the keys of the dict and is not usually
|
|
320
|
+
# intended as an iterable, so we don't transform it.
|
|
321
|
+
if isinstance(data, dict):
|
|
322
|
+
return cast(object, data)
|
|
323
|
+
|
|
314
324
|
inner_type = extract_type_arg(stripped_type, 0)
|
|
315
325
|
return [await _async_transform_recursive(d, annotation=annotation, inner_type=inner_type) for d in data]
|
|
316
326
|
|
|
@@ -324,7 +334,7 @@ async def _async_transform_recursive(
|
|
|
324
334
|
return data
|
|
325
335
|
|
|
326
336
|
if isinstance(data, pydantic.BaseModel):
|
|
327
|
-
return model_dump(data, exclude_unset=True)
|
|
337
|
+
return model_dump(data, exclude_unset=True, mode="json")
|
|
328
338
|
|
|
329
339
|
annotated_type = _get_annotated_type(annotation)
|
|
330
340
|
if annotated_type is None:
|
spitch/_utils/_utils.py
CHANGED
|
@@ -16,6 +16,7 @@ from typing import (
|
|
|
16
16
|
overload,
|
|
17
17
|
)
|
|
18
18
|
from pathlib import Path
|
|
19
|
+
from datetime import date, datetime
|
|
19
20
|
from typing_extensions import TypeGuard
|
|
20
21
|
|
|
21
22
|
import sniffio
|
|
@@ -395,3 +396,19 @@ def lru_cache(*, maxsize: int | None = 128) -> Callable[[CallableT], CallableT]:
|
|
|
395
396
|
maxsize=maxsize,
|
|
396
397
|
)
|
|
397
398
|
return cast(Any, wrapper) # type: ignore[no-any-return]
|
|
399
|
+
|
|
400
|
+
|
|
401
|
+
def json_safe(data: object) -> object:
|
|
402
|
+
"""Translates a mapping / sequence recursively in the same fashion
|
|
403
|
+
as `pydantic` v2's `model_dump(mode="json")`.
|
|
404
|
+
"""
|
|
405
|
+
if is_mapping(data):
|
|
406
|
+
return {json_safe(key): json_safe(value) for key, value in data.items()}
|
|
407
|
+
|
|
408
|
+
if is_iterable(data) and not isinstance(data, (str, bytes, bytearray)):
|
|
409
|
+
return [json_safe(item) for item in data]
|
|
410
|
+
|
|
411
|
+
if isinstance(data, (datetime, date)):
|
|
412
|
+
return data.isoformat()
|
|
413
|
+
|
|
414
|
+
return data
|
spitch/_version.py
CHANGED
spitch/resources/speech.py
CHANGED
|
@@ -62,7 +62,24 @@ class SpeechResource(SyncAPIResource):
|
|
|
62
62
|
*,
|
|
63
63
|
language: Literal["yo", "en", "ha", "ig"],
|
|
64
64
|
text: str,
|
|
65
|
-
voice: Literal[
|
|
65
|
+
voice: Literal[
|
|
66
|
+
"sade",
|
|
67
|
+
"segun",
|
|
68
|
+
"femi",
|
|
69
|
+
"funmi",
|
|
70
|
+
"amina",
|
|
71
|
+
"aliyu",
|
|
72
|
+
"hasan",
|
|
73
|
+
"zainab",
|
|
74
|
+
"ngozi",
|
|
75
|
+
"amara",
|
|
76
|
+
"ebuka",
|
|
77
|
+
"obinna",
|
|
78
|
+
"lucy",
|
|
79
|
+
"lina",
|
|
80
|
+
"john",
|
|
81
|
+
"jude",
|
|
82
|
+
],
|
|
66
83
|
stream: bool | NotGiven = NOT_GIVEN,
|
|
67
84
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
68
85
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
@@ -181,7 +198,24 @@ class AsyncSpeechResource(AsyncAPIResource):
|
|
|
181
198
|
*,
|
|
182
199
|
language: Literal["yo", "en", "ha", "ig"],
|
|
183
200
|
text: str,
|
|
184
|
-
voice: Literal[
|
|
201
|
+
voice: Literal[
|
|
202
|
+
"sade",
|
|
203
|
+
"segun",
|
|
204
|
+
"femi",
|
|
205
|
+
"funmi",
|
|
206
|
+
"amina",
|
|
207
|
+
"aliyu",
|
|
208
|
+
"hasan",
|
|
209
|
+
"zainab",
|
|
210
|
+
"ngozi",
|
|
211
|
+
"amara",
|
|
212
|
+
"ebuka",
|
|
213
|
+
"obinna",
|
|
214
|
+
"lucy",
|
|
215
|
+
"lina",
|
|
216
|
+
"john",
|
|
217
|
+
"jude",
|
|
218
|
+
],
|
|
185
219
|
stream: bool | NotGiven = NOT_GIVEN,
|
|
186
220
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
187
221
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
@@ -12,6 +12,25 @@ class SpeechGenerateParams(TypedDict, total=False):
|
|
|
12
12
|
|
|
13
13
|
text: Required[str]
|
|
14
14
|
|
|
15
|
-
voice: Required[
|
|
15
|
+
voice: Required[
|
|
16
|
+
Literal[
|
|
17
|
+
"sade",
|
|
18
|
+
"segun",
|
|
19
|
+
"femi",
|
|
20
|
+
"funmi",
|
|
21
|
+
"amina",
|
|
22
|
+
"aliyu",
|
|
23
|
+
"hasan",
|
|
24
|
+
"zainab",
|
|
25
|
+
"ngozi",
|
|
26
|
+
"amara",
|
|
27
|
+
"ebuka",
|
|
28
|
+
"obinna",
|
|
29
|
+
"lucy",
|
|
30
|
+
"lina",
|
|
31
|
+
"john",
|
|
32
|
+
"jude",
|
|
33
|
+
]
|
|
34
|
+
]
|
|
16
35
|
|
|
17
36
|
stream: bool
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: spitch
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.15.1
|
|
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
|
|
7
7
|
Author-email: Spitch <admin@spi-tch.com>
|
|
8
|
-
License
|
|
9
|
-
License-File: LICENSE
|
|
8
|
+
License: Apache-2.0
|
|
10
9
|
Classifier: Intended Audience :: Developers
|
|
11
10
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
12
11
|
Classifier: Operating System :: MacOS
|
|
@@ -14,7 +13,6 @@ Classifier: Operating System :: Microsoft :: Windows
|
|
|
14
13
|
Classifier: Operating System :: OS Independent
|
|
15
14
|
Classifier: Operating System :: POSIX
|
|
16
15
|
Classifier: Operating System :: POSIX :: Linux
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.7
|
|
18
16
|
Classifier: Programming Language :: Python :: 3.8
|
|
19
17
|
Classifier: Programming Language :: Python :: 3.9
|
|
20
18
|
Classifier: Programming Language :: Python :: 3.10
|
|
@@ -22,7 +20,7 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
22
20
|
Classifier: Programming Language :: Python :: 3.12
|
|
23
21
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
24
22
|
Classifier: Typing :: Typed
|
|
25
|
-
Requires-Python: >=3.
|
|
23
|
+
Requires-Python: >=3.8
|
|
26
24
|
Requires-Dist: anyio<5,>=3.5.0
|
|
27
25
|
Requires-Dist: cached-property; python_version < '3.8'
|
|
28
26
|
Requires-Dist: distro<2,>=1.7.0
|
|
@@ -36,7 +34,7 @@ Description-Content-Type: text/markdown
|
|
|
36
34
|
|
|
37
35
|
[](https://pypi.org/project/spitch/)
|
|
38
36
|
|
|
39
|
-
The Spitch Python library provides convenient access to the Spitch REST API from any Python 3.
|
|
37
|
+
The Spitch Python library provides convenient access to the Spitch REST API from any Python 3.8+
|
|
40
38
|
application. The library includes type definitions for all request params and response fields,
|
|
41
39
|
and offers both synchronous and asynchronous clients powered by [httpx](https://github.com/encode/httpx).
|
|
42
40
|
|
|
@@ -62,8 +60,7 @@ import os
|
|
|
62
60
|
from spitch import Spitch
|
|
63
61
|
|
|
64
62
|
client = Spitch(
|
|
65
|
-
# This is the default and can be omitted
|
|
66
|
-
api_key=os.environ.get("SPITCH_API_KEY"),
|
|
63
|
+
api_key=os.environ.get("SPITCH_API_KEY"), # This is the default and can be omitted
|
|
67
64
|
)
|
|
68
65
|
|
|
69
66
|
response = client.speech.generate(
|
|
@@ -88,8 +85,7 @@ import asyncio
|
|
|
88
85
|
from spitch import AsyncSpitch
|
|
89
86
|
|
|
90
87
|
client = AsyncSpitch(
|
|
91
|
-
# This is the default and can be omitted
|
|
92
|
-
api_key=os.environ.get("SPITCH_API_KEY"),
|
|
88
|
+
api_key=os.environ.get("SPITCH_API_KEY"), # This is the default and can be omitted
|
|
93
89
|
)
|
|
94
90
|
|
|
95
91
|
|
|
@@ -374,7 +370,7 @@ print(spitch.__version__)
|
|
|
374
370
|
|
|
375
371
|
## Requirements
|
|
376
372
|
|
|
377
|
-
Python 3.
|
|
373
|
+
Python 3.8 or higher.
|
|
378
374
|
|
|
379
375
|
## Contributing
|
|
380
376
|
|
|
@@ -1,41 +1,40 @@
|
|
|
1
1
|
spitch/__init__.py,sha256=mBQhmNu88PeR66Zmw9atnzuU8f1mpSPcW7vn-EeSikE,2399
|
|
2
|
-
spitch/_base_client.py,sha256=
|
|
2
|
+
spitch/_base_client.py,sha256=LlWEnS9IoWcUjk98wigur4NAaHIXv5wyW6TfyILoFnQ,67844
|
|
3
3
|
spitch/_client.py,sha256=wnexAmnaiafFtJM7PC9LyThw3aIkI6eLn7ZReCL2iLY,15446
|
|
4
|
-
spitch/_compat.py,sha256=
|
|
4
|
+
spitch/_compat.py,sha256=fQkXUY7reJc8m_yguMWSjHBfO8lNzw4wOAxtkhP9d1Q,6607
|
|
5
5
|
spitch/_constants.py,sha256=JE8kyZa2Q4NK_i4fO--8siEYTzeHnT0fYbOFDgDP4uk,464
|
|
6
6
|
spitch/_exceptions.py,sha256=xsQtKJTiIdz2X1bQDQFZcSW7WBofLazdQm9nMCyPEVM,3220
|
|
7
7
|
spitch/_files.py,sha256=mf4dOgL4b0ryyZlbqLhggD3GVgDf6XxdGFAgce01ugE,3549
|
|
8
|
-
spitch/_models.py,sha256=
|
|
8
|
+
spitch/_models.py,sha256=uhxvXZC0JO7HuGR_GWXH-zYKuptF2rwiGVJfMMfg3fw,28470
|
|
9
9
|
spitch/_qs.py,sha256=AOkSz4rHtK4YI3ZU_kzea-zpwBUgEY8WniGmTPyEimc,4846
|
|
10
10
|
spitch/_resource.py,sha256=TLFPcOOmtxZOQLh3XCNPB_BdrQpp0MIYoKoH52aRAu8,1100
|
|
11
11
|
spitch/_response.py,sha256=aN6swtguiZ7CC_hWFrwoUa53FgSbjRfZXxYHvfDNGeo,28609
|
|
12
12
|
spitch/_streaming.py,sha256=5SpId2EIfF8Ee8UUYmJxqgHUGP1ZdHCUHhHCdNJREFA,10100
|
|
13
|
-
spitch/_types.py,sha256=
|
|
14
|
-
spitch/_version.py,sha256=
|
|
13
|
+
spitch/_types.py,sha256=uuSZot9wXgdAMJzfF3raLmt3DvhThG7skqUC98_Dm1k,6167
|
|
14
|
+
spitch/_version.py,sha256=z1S_sncWfaMNuzwFj-vBC0LaiTBQh6QEn_kglZlFd0U,159
|
|
15
15
|
spitch/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
16
|
-
spitch/_utils/__init__.py,sha256=
|
|
16
|
+
spitch/_utils/__init__.py,sha256=k266EatJr88V8Zseb7xUimTlCeno9SynRfLwadHP1b4,2016
|
|
17
17
|
spitch/_utils/_logs.py,sha256=ApRyYK_WgZfEr_ygBUBXWMlTgeMr2tdNOGlH8jE4oJc,774
|
|
18
18
|
spitch/_utils/_proxy.py,sha256=z3zsateHtb0EARTWKk8QZNHfPkqJbqwd1lM993LBwGE,1902
|
|
19
19
|
spitch/_utils/_reflection.py,sha256=ZmGkIgT_PuwedyNBrrKGbxoWtkpytJNU1uU4QHnmEMU,1364
|
|
20
20
|
spitch/_utils/_streams.py,sha256=SMC90diFFecpEg_zgDRVbdR3hSEIgVVij4taD-noMLM,289
|
|
21
|
-
spitch/_utils/_sync.py,sha256=
|
|
22
|
-
spitch/_utils/_transform.py,sha256=
|
|
21
|
+
spitch/_utils/_sync.py,sha256=jJl-iCEaZZUAkq4IUtzN1-aMsKTUFaNoNbeYnnpQjIQ,2438
|
|
22
|
+
spitch/_utils/_transform.py,sha256=Dkkyr7OveGmOolepcvXmVJWE3kqim4b0nM0h7yWbgeY,13468
|
|
23
23
|
spitch/_utils/_typing.py,sha256=tFbktdpdHCQliwzGsWysgn0P5H0JRdagkZdb_LegGkY,3838
|
|
24
|
-
spitch/_utils/_utils.py,sha256=
|
|
24
|
+
spitch/_utils/_utils.py,sha256=8UmbPOy_AAr2uUjjFui-VZSrVBHRj6bfNEKRp5YZP2A,12004
|
|
25
25
|
spitch/lib/.keep,sha256=wuNrz-5SXo3jJaJOJgz4vFHM41YH_g20F5cRQo0vLes,224
|
|
26
26
|
spitch/resources/__init__.py,sha256=KT6rAvIlWHQk9QdM4Jp8ABziKILaBrrtiO7LCB5Wa5E,976
|
|
27
|
-
spitch/resources/speech.py,sha256=
|
|
27
|
+
spitch/resources/speech.py,sha256=FXV0ld21gf6368siL679DV3d2_2EgG7jRtWsuHQVm4I,12937
|
|
28
28
|
spitch/resources/text.py,sha256=Gno8dQg7jeL8rslqqURyu4t-5_lLwziYgCRvgY8V9XM,9665
|
|
29
29
|
spitch/types/__init__.py,sha256=xBZbzXwV3WlBdawp4Mb4IqoQG4VfaLbi-4FMqPbwqlE,704
|
|
30
|
-
spitch/types/speech_generate_params.py,sha256=
|
|
31
|
-
spitch/types/speech_transcibe_params.py,sha256=WvwBsSctqJDXOFJNYyjfijwCnAdJCPkJobESfmLy3aI,448
|
|
30
|
+
spitch/types/speech_generate_params.py,sha256=gLIzNBaevzSLv9-m-chhA3dl7lZg3M1VQ7CPnLD5leU,758
|
|
32
31
|
spitch/types/speech_transcribe_params.py,sha256=2nUgsYIURWTKx8qBYE0WfIHh6hXVcdgCz-UC1wIaXpA,515
|
|
33
|
-
spitch/types/speech_transcribe_response.py,sha256=
|
|
32
|
+
spitch/types/speech_transcribe_response.py,sha256=mGNIIK-A_YOTi78tlYMRCKykPiFjSWm4gsRjPk1IvF8,516
|
|
34
33
|
spitch/types/text_tone_mark_params.py,sha256=63P5VElxanYkDP1ZLEuQt97JSgVpMCaAo4WRWLDvhlY,349
|
|
35
34
|
spitch/types/text_tone_mark_response.py,sha256=WGxZsBxLceZ03VM5dafZshp6azdDxpNHcJHhBX7A5DY,277
|
|
36
35
|
spitch/types/text_translate_params.py,sha256=rU5hbTyBaP5L_akmgswHoNLcTKWN0Gz1kL1yt3EQL44,404
|
|
37
36
|
spitch/types/text_translate_response.py,sha256=Az3QSpvarlCNTiB7uVzMH21YoWHWJMBEvgdKgVJZW4M,279
|
|
38
|
-
spitch-1.
|
|
39
|
-
spitch-1.
|
|
40
|
-
spitch-1.
|
|
41
|
-
spitch-1.
|
|
37
|
+
spitch-1.15.1.dist-info/METADATA,sha256=5_dLshgAVey5fsV4kXvqJHBgr7Ihj-gbE16mLwlLzUo,12557
|
|
38
|
+
spitch-1.15.1.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
|
|
39
|
+
spitch-1.15.1.dist-info/licenses/LICENSE,sha256=529F8Amq5MfoIm33JY544oweKES9vw9_xS1CNx-ztPI,11336
|
|
40
|
+
spitch-1.15.1.dist-info/RECORD,,
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
-
|
|
3
|
-
from __future__ import annotations
|
|
4
|
-
|
|
5
|
-
from typing import Optional
|
|
6
|
-
from typing_extensions import Literal, Required, TypedDict
|
|
7
|
-
|
|
8
|
-
from .._types import FileTypes
|
|
9
|
-
|
|
10
|
-
__all__ = ["SpeechTranscibeParams"]
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
class SpeechTranscibeParams(TypedDict, total=False):
|
|
14
|
-
language: Required[Literal["yo", "en", "ha", "ig"]]
|
|
15
|
-
|
|
16
|
-
content: Optional[FileTypes]
|
|
17
|
-
|
|
18
|
-
url: Optional[str]
|
|
File without changes
|