spitch 1.1.0__py3-none-any.whl → 1.2.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 +31 -17
- {spitch-1.1.0.dist-info → spitch-1.2.0.dist-info}/METADATA +1 -1
- {spitch-1.1.0.dist-info → spitch-1.2.0.dist-info}/RECORD +6 -6
- {spitch-1.1.0.dist-info → spitch-1.2.0.dist-info}/WHEEL +0 -0
- {spitch-1.1.0.dist-info → spitch-1.2.0.dist-info}/licenses/LICENSE +0 -0
spitch/_version.py
CHANGED
spitch/resources/speech.py
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
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
|
|
@@ -10,7 +10,9 @@ import httpx
|
|
|
10
10
|
from ..types import speech_generate_params, speech_transcibe_params
|
|
11
11
|
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven, FileTypes
|
|
12
12
|
from .._utils import (
|
|
13
|
+
extract_files,
|
|
13
14
|
maybe_transform,
|
|
15
|
+
deepcopy_minimal,
|
|
14
16
|
async_maybe_transform,
|
|
15
17
|
)
|
|
16
18
|
from .._compat import cached_property
|
|
@@ -121,16 +123,22 @@ class SpeechResource(SyncAPIResource):
|
|
|
121
123
|
|
|
122
124
|
timeout: Override the client-level default timeout for this request, in seconds
|
|
123
125
|
"""
|
|
126
|
+
body = deepcopy_minimal(
|
|
127
|
+
{
|
|
128
|
+
"language": language,
|
|
129
|
+
"content": content,
|
|
130
|
+
"url": url,
|
|
131
|
+
}
|
|
132
|
+
)
|
|
133
|
+
files = extract_files(cast(Mapping[str, object], body), paths=[["content"]])
|
|
134
|
+
# It should be noted that the actual Content-Type header that will be
|
|
135
|
+
# sent to the server will contain a `boundary` parameter, e.g.
|
|
136
|
+
# multipart/form-data; boundary=---abc--
|
|
137
|
+
extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}
|
|
124
138
|
return self._post(
|
|
125
139
|
"/v1/transcriptions",
|
|
126
|
-
body=maybe_transform(
|
|
127
|
-
|
|
128
|
-
"language": language,
|
|
129
|
-
"content": content,
|
|
130
|
-
"url": url,
|
|
131
|
-
},
|
|
132
|
-
speech_transcibe_params.SpeechTranscibeParams,
|
|
133
|
-
),
|
|
140
|
+
body=maybe_transform(body, speech_transcibe_params.SpeechTranscibeParams),
|
|
141
|
+
files=files,
|
|
134
142
|
options=make_request_options(
|
|
135
143
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
136
144
|
),
|
|
@@ -229,16 +237,22 @@ class AsyncSpeechResource(AsyncAPIResource):
|
|
|
229
237
|
|
|
230
238
|
timeout: Override the client-level default timeout for this request, in seconds
|
|
231
239
|
"""
|
|
240
|
+
body = deepcopy_minimal(
|
|
241
|
+
{
|
|
242
|
+
"language": language,
|
|
243
|
+
"content": content,
|
|
244
|
+
"url": url,
|
|
245
|
+
}
|
|
246
|
+
)
|
|
247
|
+
files = extract_files(cast(Mapping[str, object], body), paths=[["content"]])
|
|
248
|
+
# It should be noted that the actual Content-Type header that will be
|
|
249
|
+
# sent to the server will contain a `boundary` parameter, e.g.
|
|
250
|
+
# multipart/form-data; boundary=---abc--
|
|
251
|
+
extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}
|
|
232
252
|
return await self._post(
|
|
233
253
|
"/v1/transcriptions",
|
|
234
|
-
body=await async_maybe_transform(
|
|
235
|
-
|
|
236
|
-
"language": language,
|
|
237
|
-
"content": content,
|
|
238
|
-
"url": url,
|
|
239
|
-
},
|
|
240
|
-
speech_transcibe_params.SpeechTranscibeParams,
|
|
241
|
-
),
|
|
254
|
+
body=await async_maybe_transform(body, speech_transcibe_params.SpeechTranscibeParams),
|
|
255
|
+
files=files,
|
|
242
256
|
options=make_request_options(
|
|
243
257
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
244
258
|
),
|
|
@@ -11,7 +11,7 @@ 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
13
|
spitch/_types.py,sha256=dsJyGWdBXaYJaRBqn2V3iRsfpWw71rFaSxdSM8sPQYY,6103
|
|
14
|
-
spitch/_version.py,sha256=
|
|
14
|
+
spitch/_version.py,sha256=ppV27oNFCTollcXLr72xRicR-tut-sjhbRZ2p34ocYw,158
|
|
15
15
|
spitch/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
16
16
|
spitch/_utils/__init__.py,sha256=Uzq1-FIih_VUjzdNVWXks0sdC39KBKLMrZoz-_JOjJ4,1988
|
|
17
17
|
spitch/_utils/_logs.py,sha256=ApRyYK_WgZfEr_ygBUBXWMlTgeMr2tdNOGlH8jE4oJc,774
|
|
@@ -24,13 +24,13 @@ spitch/_utils/_typing.py,sha256=tFbktdpdHCQliwzGsWysgn0P5H0JRdagkZdb_LegGkY,3838
|
|
|
24
24
|
spitch/_utils/_utils.py,sha256=tYrr7IX-5NMwsVKbNggbzOM84uNw7XnAe06e2Ln8Or0,11472
|
|
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=CcrXiaQfilPEdvLh2YundmNcbTvJj7EgNVsFdf0I7rQ,11386
|
|
28
28
|
spitch/resources/text.py,sha256=xy7N1q5ioXVMtmcW6iOE8j8n9j4lvnpvO4jJ9FMZmsU,6071
|
|
29
29
|
spitch/types/__init__.py,sha256=4aa9CgcCmGRqZb4k9F3005Q4Ok-zjiiqw5k3BXIQ3MY,364
|
|
30
30
|
spitch/types/speech_generate_params.py,sha256=kNVcFxcIcImiLa8r4OEbzeIOqZNtkbSUek99t2ljhaI,425
|
|
31
31
|
spitch/types/speech_transcibe_params.py,sha256=WvwBsSctqJDXOFJNYyjfijwCnAdJCPkJobESfmLy3aI,448
|
|
32
32
|
spitch/types/text_tone_mark_params.py,sha256=63P5VElxanYkDP1ZLEuQt97JSgVpMCaAo4WRWLDvhlY,349
|
|
33
|
-
spitch-1.
|
|
34
|
-
spitch-1.
|
|
35
|
-
spitch-1.
|
|
36
|
-
spitch-1.
|
|
33
|
+
spitch-1.2.0.dist-info/METADATA,sha256=CVCkjJbGIKDWZWcGc6yjmHD3GrkGELiNkLyCFe4mjJo,12392
|
|
34
|
+
spitch-1.2.0.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
|
|
35
|
+
spitch-1.2.0.dist-info/licenses/LICENSE,sha256=529F8Amq5MfoIm33JY544oweKES9vw9_xS1CNx-ztPI,11336
|
|
36
|
+
spitch-1.2.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|