spitch 1.0.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 CHANGED
@@ -1,4 +1,4 @@
1
1
  # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  __title__ = "spitch"
4
- __version__ = "1.0.0" # x-release-please-version
4
+ __version__ = "1.2.0" # x-release-please-version
@@ -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,16 +10,22 @@ 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
17
19
  from .._resource import SyncAPIResource, AsyncAPIResource
18
20
  from .._response import (
21
+ StreamedBinaryAPIResponse,
22
+ AsyncStreamedBinaryAPIResponse,
19
23
  to_raw_response_wrapper,
20
24
  to_streamed_response_wrapper,
21
25
  async_to_raw_response_wrapper,
22
26
  async_to_streamed_response_wrapper,
27
+ to_custom_streamed_response_wrapper,
28
+ async_to_custom_streamed_response_wrapper,
23
29
  )
24
30
  from .._base_client import make_request_options
25
31
 
@@ -117,16 +123,22 @@ class SpeechResource(SyncAPIResource):
117
123
 
118
124
  timeout: Override the client-level default timeout for this request, in seconds
119
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 {})}
120
138
  return self._post(
121
139
  "/v1/transcriptions",
122
- body=maybe_transform(
123
- {
124
- "language": language,
125
- "content": content,
126
- "url": url,
127
- },
128
- speech_transcibe_params.SpeechTranscibeParams,
129
- ),
140
+ body=maybe_transform(body, speech_transcibe_params.SpeechTranscibeParams),
141
+ files=files,
130
142
  options=make_request_options(
131
143
  extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
132
144
  ),
@@ -225,16 +237,22 @@ class AsyncSpeechResource(AsyncAPIResource):
225
237
 
226
238
  timeout: Override the client-level default timeout for this request, in seconds
227
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 {})}
228
252
  return await self._post(
229
253
  "/v1/transcriptions",
230
- body=await async_maybe_transform(
231
- {
232
- "language": language,
233
- "content": content,
234
- "url": url,
235
- },
236
- speech_transcibe_params.SpeechTranscibeParams,
237
- ),
254
+ body=await async_maybe_transform(body, speech_transcibe_params.SpeechTranscibeParams),
255
+ files=files,
238
256
  options=make_request_options(
239
257
  extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
240
258
  ),
@@ -270,8 +288,9 @@ class SpeechResourceWithStreamingResponse:
270
288
  def __init__(self, speech: SpeechResource) -> None:
271
289
  self._speech = speech
272
290
 
273
- self.generate = to_streamed_response_wrapper(
291
+ self.generate = to_custom_streamed_response_wrapper(
274
292
  speech.generate,
293
+ StreamedBinaryAPIResponse
275
294
  )
276
295
  self.transcibe = to_streamed_response_wrapper(
277
296
  speech.transcibe,
@@ -282,8 +301,9 @@ class AsyncSpeechResourceWithStreamingResponse:
282
301
  def __init__(self, speech: AsyncSpeechResource) -> None:
283
302
  self._speech = speech
284
303
 
285
- self.generate = async_to_streamed_response_wrapper(
304
+ self.generate = async_to_custom_streamed_response_wrapper(
286
305
  speech.generate,
306
+ AsyncStreamedBinaryAPIResponse
287
307
  )
288
308
  self.transcibe = async_to_streamed_response_wrapper(
289
309
  speech.transcibe,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: spitch
3
- Version: 1.0.0
3
+ Version: 1.2.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
@@ -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=AygsuXn5LCrA7nuoSGQjAcykgCeHRzzfyb0jcCjDHKM,158
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=kjlHNZyfr273acLQhWlSwL-pvxEcGuI6t4SZ8G-cEcs,10292
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.0.0.dist-info/METADATA,sha256=txasUwXuJxi0K49QwuwauukORQJK2ZauKauqxHqGJpc,12392
34
- spitch-1.0.0.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
35
- spitch-1.0.0.dist-info/licenses/LICENSE,sha256=529F8Amq5MfoIm33JY544oweKES9vw9_xS1CNx-ztPI,11336
36
- spitch-1.0.0.dist-info/RECORD,,
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