spitch 1.31.0__py3-none-any.whl → 1.33.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/speech.py +36 -24
- {spitch-1.31.0.dist-info → spitch-1.33.0.dist-info}/METADATA +10 -7
- {spitch-1.31.0.dist-info → spitch-1.33.0.dist-info}/RECORD +6 -6
- {spitch-1.31.0.dist-info → spitch-1.33.0.dist-info}/WHEEL +0 -0
- {spitch-1.31.0.dist-info → spitch-1.33.0.dist-info}/licenses/LICENSE +0 -0
spitch/_version.py
CHANGED
spitch/resources/speech.py
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from typing import Optional
|
|
5
|
+
from typing import Mapping, Optional, cast
|
|
6
6
|
from typing_extensions import Literal
|
|
7
7
|
|
|
8
8
|
import httpx
|
|
9
9
|
|
|
10
10
|
from ..types import speech_generate_params, speech_transcribe_params
|
|
11
11
|
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven, FileTypes
|
|
12
|
-
from .._utils import maybe_transform, async_maybe_transform
|
|
12
|
+
from .._utils import extract_files, maybe_transform, deepcopy_minimal, async_maybe_transform
|
|
13
13
|
from .._compat import cached_property
|
|
14
14
|
from .._resource import SyncAPIResource, AsyncAPIResource
|
|
15
15
|
from .._response import (
|
|
@@ -147,19 +147,25 @@ class SpeechResource(SyncAPIResource):
|
|
|
147
147
|
|
|
148
148
|
timeout: Override the client-level default timeout for this request, in seconds
|
|
149
149
|
"""
|
|
150
|
+
body = deepcopy_minimal(
|
|
151
|
+
{
|
|
152
|
+
"language": language,
|
|
153
|
+
"content": content,
|
|
154
|
+
"model": model,
|
|
155
|
+
"special_words": special_words,
|
|
156
|
+
"timestamp": timestamp,
|
|
157
|
+
"url": url,
|
|
158
|
+
}
|
|
159
|
+
)
|
|
160
|
+
files = extract_files(cast(Mapping[str, object], body), paths=[["content"]])
|
|
161
|
+
# It should be noted that the actual Content-Type header that will be
|
|
162
|
+
# sent to the server will contain a `boundary` parameter, e.g.
|
|
163
|
+
# multipart/form-data; boundary=---abc--
|
|
164
|
+
extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}
|
|
150
165
|
return self._post(
|
|
151
166
|
"/v1/transcriptions",
|
|
152
|
-
body=maybe_transform(
|
|
153
|
-
|
|
154
|
-
"language": language,
|
|
155
|
-
"content": content,
|
|
156
|
-
"model": model,
|
|
157
|
-
"special_words": special_words,
|
|
158
|
-
"timestamp": timestamp,
|
|
159
|
-
"url": url,
|
|
160
|
-
},
|
|
161
|
-
speech_transcribe_params.SpeechTranscribeParams,
|
|
162
|
-
),
|
|
167
|
+
body=maybe_transform(body, speech_transcribe_params.SpeechTranscribeParams),
|
|
168
|
+
files=files,
|
|
163
169
|
options=make_request_options(
|
|
164
170
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
165
171
|
),
|
|
@@ -282,19 +288,25 @@ class AsyncSpeechResource(AsyncAPIResource):
|
|
|
282
288
|
|
|
283
289
|
timeout: Override the client-level default timeout for this request, in seconds
|
|
284
290
|
"""
|
|
291
|
+
body = deepcopy_minimal(
|
|
292
|
+
{
|
|
293
|
+
"language": language,
|
|
294
|
+
"content": content,
|
|
295
|
+
"model": model,
|
|
296
|
+
"special_words": special_words,
|
|
297
|
+
"timestamp": timestamp,
|
|
298
|
+
"url": url,
|
|
299
|
+
}
|
|
300
|
+
)
|
|
301
|
+
files = extract_files(cast(Mapping[str, object], body), paths=[["content"]])
|
|
302
|
+
# It should be noted that the actual Content-Type header that will be
|
|
303
|
+
# sent to the server will contain a `boundary` parameter, e.g.
|
|
304
|
+
# multipart/form-data; boundary=---abc--
|
|
305
|
+
extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}
|
|
285
306
|
return await self._post(
|
|
286
307
|
"/v1/transcriptions",
|
|
287
|
-
body=await async_maybe_transform(
|
|
288
|
-
|
|
289
|
-
"language": language,
|
|
290
|
-
"content": content,
|
|
291
|
-
"model": model,
|
|
292
|
-
"special_words": special_words,
|
|
293
|
-
"timestamp": timestamp,
|
|
294
|
-
"url": url,
|
|
295
|
-
},
|
|
296
|
-
speech_transcribe_params.SpeechTranscribeParams,
|
|
297
|
-
),
|
|
308
|
+
body=await async_maybe_transform(body, speech_transcribe_params.SpeechTranscribeParams),
|
|
309
|
+
files=files,
|
|
298
310
|
options=make_request_options(
|
|
299
311
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
300
312
|
),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: spitch
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.33.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
|
|
@@ -65,10 +65,11 @@ from spitch import Spitch
|
|
|
65
65
|
|
|
66
66
|
client = Spitch()
|
|
67
67
|
|
|
68
|
-
response = client.speech.
|
|
68
|
+
response = client.speech.generate(
|
|
69
69
|
language="yo",
|
|
70
|
+
text="text",
|
|
71
|
+
voice="sade",
|
|
70
72
|
)
|
|
71
|
-
print(response.request_id)
|
|
72
73
|
```
|
|
73
74
|
|
|
74
75
|
While you can provide an `api_key` keyword argument,
|
|
@@ -88,10 +89,11 @@ client = AsyncSpitch()
|
|
|
88
89
|
|
|
89
90
|
|
|
90
91
|
async def main() -> None:
|
|
91
|
-
response = await client.speech.
|
|
92
|
+
response = await client.speech.generate(
|
|
92
93
|
language="yo",
|
|
94
|
+
text="text",
|
|
95
|
+
voice="sade",
|
|
93
96
|
)
|
|
94
|
-
print(response.request_id)
|
|
95
97
|
|
|
96
98
|
|
|
97
99
|
asyncio.run(main())
|
|
@@ -122,10 +124,11 @@ async def main() -> None:
|
|
|
122
124
|
async with AsyncSpitch(
|
|
123
125
|
http_client=DefaultAioHttpClient(),
|
|
124
126
|
) as client:
|
|
125
|
-
response = await client.speech.
|
|
127
|
+
response = await client.speech.generate(
|
|
126
128
|
language="yo",
|
|
129
|
+
text="text",
|
|
130
|
+
voice="sade",
|
|
127
131
|
)
|
|
128
|
-
print(response.request_id)
|
|
129
132
|
|
|
130
133
|
|
|
131
134
|
asyncio.run(main())
|
|
@@ -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=lccvqVi8E6-4SKt0rn1e9XXNePb0WwdDc10sPVSCygI,6221
|
|
14
|
-
spitch/_version.py,sha256=
|
|
14
|
+
spitch/_version.py,sha256=a7JHvqQhjp9-r2hqpy8ujWYHWPMeLK_9Ou4jmlf3DyY,159
|
|
15
15
|
spitch/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
16
16
|
spitch/_utils/__init__.py,sha256=k266EatJr88V8Zseb7xUimTlCeno9SynRfLwadHP1b4,2016
|
|
17
17
|
spitch/_utils/_logs.py,sha256=ApRyYK_WgZfEr_ygBUBXWMlTgeMr2tdNOGlH8jE4oJc,774
|
|
@@ -25,7 +25,7 @@ spitch/_utils/_typing.py,sha256=9UuSEnmE7dgm1SG45Mt-ga1sBhnvZHpq3f2dXbhW1NM,3939
|
|
|
25
25
|
spitch/_utils/_utils.py,sha256=ts4CiiuNpFiGB6YMdkQRh2SZvYvsl7mAF-JWHCcLDf4,12312
|
|
26
26
|
spitch/lib/.keep,sha256=wuNrz-5SXo3jJaJOJgz4vFHM41YH_g20F5cRQo0vLes,224
|
|
27
27
|
spitch/resources/__init__.py,sha256=KT6rAvIlWHQk9QdM4Jp8ABziKILaBrrtiO7LCB5Wa5E,976
|
|
28
|
-
spitch/resources/speech.py,sha256=
|
|
28
|
+
spitch/resources/speech.py,sha256=3MFk65IFJkjQ4uhA8OJff9yHoT3ghcbt6uLA77H0a-s,13270
|
|
29
29
|
spitch/resources/text.py,sha256=wWIE7uyvthKfhkOtoodTBDv_0s6YgWgAqxwICquDSyo,9680
|
|
30
30
|
spitch/types/__init__.py,sha256=xBZbzXwV3WlBdawp4Mb4IqoQG4VfaLbi-4FMqPbwqlE,704
|
|
31
31
|
spitch/types/speech_generate_params.py,sha256=m5FQnPfVxcikB5UJTn-2WjttOP5tJ8BMO0LbGPktMe0,939
|
|
@@ -35,7 +35,7 @@ spitch/types/text_tone_mark_params.py,sha256=MEnWzcSjPT_Z_8Mio96LgwYbx2BngG5By-M
|
|
|
35
35
|
spitch/types/text_tone_mark_response.py,sha256=AtLA2N7tzhxzuTYxS3PwJfPgjGQxIlgTZmTzIUdxKMA,231
|
|
36
36
|
spitch/types/text_translate_params.py,sha256=skEeG7oTZUSl_gugnqL4Mb7HE_pEFhKNygZPTvci2hA,416
|
|
37
37
|
spitch/types/text_translate_response.py,sha256=oehUy3S8jyHTLUFhHTV9LtVhkPGxSasENXEPoK4F6-M,233
|
|
38
|
-
spitch-1.
|
|
39
|
-
spitch-1.
|
|
40
|
-
spitch-1.
|
|
41
|
-
spitch-1.
|
|
38
|
+
spitch-1.33.0.dist-info/METADATA,sha256=XJ1Zu93BU3seH2t-9l5KNWzFkdbM06BFpe9KnNn7woo,14036
|
|
39
|
+
spitch-1.33.0.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
|
|
40
|
+
spitch-1.33.0.dist-info/licenses/LICENSE,sha256=C0lDWY-no8IxmnqzQA9BA7Z8jeh_bogVPfeWSgeDDcc,11336
|
|
41
|
+
spitch-1.33.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|