spitch 1.7.0__py3-none-any.whl → 1.9.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.7.0" # x-release-please-version
4
+ __version__ = "1.9.0" # x-release-please-version
@@ -18,18 +18,10 @@ from .._utils import (
18
18
  from .._compat import cached_property
19
19
  from .._resource import SyncAPIResource, AsyncAPIResource
20
20
  from .._response import (
21
- BinaryAPIResponse,
22
- AsyncBinaryAPIResponse,
23
- StreamedBinaryAPIResponse,
24
- AsyncStreamedBinaryAPIResponse,
25
21
  to_raw_response_wrapper,
26
22
  to_streamed_response_wrapper,
27
23
  async_to_raw_response_wrapper,
28
- to_custom_raw_response_wrapper,
29
24
  async_to_streamed_response_wrapper,
30
- to_custom_streamed_response_wrapper,
31
- async_to_custom_raw_response_wrapper,
32
- async_to_custom_streamed_response_wrapper,
33
25
  )
34
26
  from .._base_client import make_request_options
35
27
 
@@ -61,14 +53,15 @@ class SpeechResource(SyncAPIResource):
61
53
  *,
62
54
  language: Literal["yo", "en", "ha", "ig"],
63
55
  text: str,
64
- voice: Literal["sade", "segun", "femi", "funmi"],
56
+ stream: bool | NotGiven = NOT_GIVEN,
57
+ voice: Literal["sade", "segun", "femi", "funmi"] | NotGiven = NOT_GIVEN,
65
58
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
66
59
  # The extra values given here take precedence over values defined on the client or passed to this method.
67
60
  extra_headers: Headers | None = None,
68
61
  extra_query: Query | None = None,
69
62
  extra_body: Body | None = None,
70
63
  timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
71
- ) -> BinaryAPIResponse:
64
+ ) -> object:
72
65
  """
73
66
  Synthesize
74
67
 
@@ -81,7 +74,6 @@ class SpeechResource(SyncAPIResource):
81
74
 
82
75
  timeout: Override the client-level default timeout for this request, in seconds
83
76
  """
84
- extra_headers = {"Accept": "audio/wav", **(extra_headers or {})}
85
77
  return self._post(
86
78
  "/v1/speech",
87
79
  body=maybe_transform(
@@ -93,9 +85,13 @@ class SpeechResource(SyncAPIResource):
93
85
  speech_generate_params.SpeechGenerateParams,
94
86
  ),
95
87
  options=make_request_options(
96
- extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
88
+ extra_headers=extra_headers,
89
+ extra_query=extra_query,
90
+ extra_body=extra_body,
91
+ timeout=timeout,
92
+ query=maybe_transform({"stream": stream}, speech_generate_params.SpeechGenerateParams),
97
93
  ),
98
- cast_to=BinaryAPIResponse,
94
+ cast_to=object,
99
95
  )
100
96
 
101
97
  def transcribe(
@@ -171,14 +167,15 @@ class AsyncSpeechResource(AsyncAPIResource):
171
167
  *,
172
168
  language: Literal["yo", "en", "ha", "ig"],
173
169
  text: str,
174
- voice: Literal["sade", "segun", "femi", "funmi"],
170
+ stream: bool | NotGiven = NOT_GIVEN,
171
+ voice: Literal["sade", "segun", "femi", "funmi"] | NotGiven = NOT_GIVEN,
175
172
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
176
173
  # The extra values given here take precedence over values defined on the client or passed to this method.
177
174
  extra_headers: Headers | None = None,
178
175
  extra_query: Query | None = None,
179
176
  extra_body: Body | None = None,
180
177
  timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
181
- ) -> AsyncBinaryAPIResponse:
178
+ ) -> object:
182
179
  """
183
180
  Synthesize
184
181
 
@@ -191,7 +188,6 @@ class AsyncSpeechResource(AsyncAPIResource):
191
188
 
192
189
  timeout: Override the client-level default timeout for this request, in seconds
193
190
  """
194
- extra_headers = {"Accept": "audio/wav", **(extra_headers or {})}
195
191
  return await self._post(
196
192
  "/v1/speech",
197
193
  body=await async_maybe_transform(
@@ -203,9 +199,13 @@ class AsyncSpeechResource(AsyncAPIResource):
203
199
  speech_generate_params.SpeechGenerateParams,
204
200
  ),
205
201
  options=make_request_options(
206
- extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
202
+ extra_headers=extra_headers,
203
+ extra_query=extra_query,
204
+ extra_body=extra_body,
205
+ timeout=timeout,
206
+ query=await async_maybe_transform({"stream": stream}, speech_generate_params.SpeechGenerateParams),
207
207
  ),
208
- cast_to=AsyncBinaryAPIResponse,
208
+ cast_to=object,
209
209
  )
210
210
 
211
211
  async def transcribe(
@@ -260,9 +260,8 @@ class SpeechResourceWithRawResponse:
260
260
  def __init__(self, speech: SpeechResource) -> None:
261
261
  self._speech = speech
262
262
 
263
- self.generate = to_custom_raw_response_wrapper(
263
+ self.generate = to_raw_response_wrapper(
264
264
  speech.generate,
265
- BinaryAPIResponse,
266
265
  )
267
266
  self.transcribe = to_raw_response_wrapper(
268
267
  speech.transcribe,
@@ -273,9 +272,8 @@ class AsyncSpeechResourceWithRawResponse:
273
272
  def __init__(self, speech: AsyncSpeechResource) -> None:
274
273
  self._speech = speech
275
274
 
276
- self.generate = async_to_custom_raw_response_wrapper(
275
+ self.generate = async_to_raw_response_wrapper(
277
276
  speech.generate,
278
- AsyncBinaryAPIResponse,
279
277
  )
280
278
  self.transcribe = async_to_raw_response_wrapper(
281
279
  speech.transcribe,
@@ -286,7 +284,7 @@ class SpeechResourceWithStreamingResponse:
286
284
  def __init__(self, speech: SpeechResource) -> None:
287
285
  self._speech = speech
288
286
 
289
- self.generate = to_custom_streamed_response_wrapper(
287
+ self.generate = to_streamed_response_wrapper(
290
288
  speech.generate,
291
289
  StreamedBinaryAPIResponse
292
290
  )
@@ -299,7 +297,7 @@ class AsyncSpeechResourceWithStreamingResponse:
299
297
  def __init__(self, speech: AsyncSpeechResource) -> None:
300
298
  self._speech = speech
301
299
 
302
- self.generate = async_to_custom_streamed_response_wrapper(
300
+ self.generate = async_to_streamed_response_wrapper(
303
301
  speech.generate,
304
302
  AsyncStreamedBinaryAPIResponse
305
303
  )
spitch/resources/text.py CHANGED
@@ -6,7 +6,7 @@ from typing_extensions import Literal
6
6
 
7
7
  import httpx
8
8
 
9
- from ..types import text_tone_mark_params
9
+ from ..types import text_tone_mark_params, text_translate_params
10
10
  from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
11
11
  from .._utils import (
12
12
  maybe_transform,
@@ -84,6 +84,47 @@ class TextResource(SyncAPIResource):
84
84
  cast_to=object,
85
85
  )
86
86
 
87
+ def translate(
88
+ self,
89
+ *,
90
+ source: Literal["yo", "en", "ha", "ig"],
91
+ target: Literal["yo", "en", "ha", "ig"],
92
+ text: str,
93
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
94
+ # The extra values given here take precedence over values defined on the client or passed to this method.
95
+ extra_headers: Headers | None = None,
96
+ extra_query: Query | None = None,
97
+ extra_body: Body | None = None,
98
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
99
+ ) -> object:
100
+ """
101
+ Translate
102
+
103
+ Args:
104
+ extra_headers: Send extra headers
105
+
106
+ extra_query: Add additional query parameters to the request
107
+
108
+ extra_body: Add additional JSON properties to the request
109
+
110
+ timeout: Override the client-level default timeout for this request, in seconds
111
+ """
112
+ return self._post(
113
+ "/v1/translate",
114
+ body=maybe_transform(
115
+ {
116
+ "source": source,
117
+ "target": target,
118
+ "text": text,
119
+ },
120
+ text_translate_params.TextTranslateParams,
121
+ ),
122
+ options=make_request_options(
123
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
124
+ ),
125
+ cast_to=object,
126
+ )
127
+
87
128
 
88
129
  class AsyncTextResource(AsyncAPIResource):
89
130
  @cached_property
@@ -144,6 +185,47 @@ class AsyncTextResource(AsyncAPIResource):
144
185
  cast_to=object,
145
186
  )
146
187
 
188
+ async def translate(
189
+ self,
190
+ *,
191
+ source: Literal["yo", "en", "ha", "ig"],
192
+ target: Literal["yo", "en", "ha", "ig"],
193
+ text: str,
194
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
195
+ # The extra values given here take precedence over values defined on the client or passed to this method.
196
+ extra_headers: Headers | None = None,
197
+ extra_query: Query | None = None,
198
+ extra_body: Body | None = None,
199
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
200
+ ) -> object:
201
+ """
202
+ Translate
203
+
204
+ Args:
205
+ extra_headers: Send extra headers
206
+
207
+ extra_query: Add additional query parameters to the request
208
+
209
+ extra_body: Add additional JSON properties to the request
210
+
211
+ timeout: Override the client-level default timeout for this request, in seconds
212
+ """
213
+ return await self._post(
214
+ "/v1/translate",
215
+ body=await async_maybe_transform(
216
+ {
217
+ "source": source,
218
+ "target": target,
219
+ "text": text,
220
+ },
221
+ text_translate_params.TextTranslateParams,
222
+ ),
223
+ options=make_request_options(
224
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
225
+ ),
226
+ cast_to=object,
227
+ )
228
+
147
229
 
148
230
  class TextResourceWithRawResponse:
149
231
  def __init__(self, text: TextResource) -> None:
@@ -152,6 +234,9 @@ class TextResourceWithRawResponse:
152
234
  self.tone_mark = to_raw_response_wrapper(
153
235
  text.tone_mark,
154
236
  )
237
+ self.translate = to_raw_response_wrapper(
238
+ text.translate,
239
+ )
155
240
 
156
241
 
157
242
  class AsyncTextResourceWithRawResponse:
@@ -161,6 +246,9 @@ class AsyncTextResourceWithRawResponse:
161
246
  self.tone_mark = async_to_raw_response_wrapper(
162
247
  text.tone_mark,
163
248
  )
249
+ self.translate = async_to_raw_response_wrapper(
250
+ text.translate,
251
+ )
164
252
 
165
253
 
166
254
  class TextResourceWithStreamingResponse:
@@ -170,6 +258,9 @@ class TextResourceWithStreamingResponse:
170
258
  self.tone_mark = to_streamed_response_wrapper(
171
259
  text.tone_mark,
172
260
  )
261
+ self.translate = to_streamed_response_wrapper(
262
+ text.translate,
263
+ )
173
264
 
174
265
 
175
266
  class AsyncTextResourceWithStreamingResponse:
@@ -179,3 +270,6 @@ class AsyncTextResourceWithStreamingResponse:
179
270
  self.tone_mark = async_to_streamed_response_wrapper(
180
271
  text.tone_mark,
181
272
  )
273
+ self.translate = async_to_streamed_response_wrapper(
274
+ text.translate,
275
+ )
spitch/types/__init__.py CHANGED
@@ -3,5 +3,6 @@
3
3
  from __future__ import annotations
4
4
 
5
5
  from .text_tone_mark_params import TextToneMarkParams as TextToneMarkParams
6
+ from .text_translate_params import TextTranslateParams as TextTranslateParams
6
7
  from .speech_generate_params import SpeechGenerateParams as SpeechGenerateParams
7
8
  from .speech_transcribe_params import SpeechTranscribeParams as SpeechTranscribeParams
@@ -12,4 +12,6 @@ class SpeechGenerateParams(TypedDict, total=False):
12
12
 
13
13
  text: Required[str]
14
14
 
15
- voice: Required[Literal["sade", "segun", "femi", "funmi"]]
15
+ stream: bool
16
+
17
+ voice: Literal["sade", "segun", "femi", "funmi"]
@@ -0,0 +1,15 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing_extensions import Literal, Required, TypedDict
6
+
7
+ __all__ = ["TextTranslateParams"]
8
+
9
+
10
+ class TextTranslateParams(TypedDict, total=False):
11
+ source: Required[Literal["yo", "en", "ha", "ig"]]
12
+
13
+ target: Required[Literal["yo", "en", "ha", "ig"]]
14
+
15
+ text: Required[str]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: spitch
3
- Version: 1.7.0
3
+ Version: 1.9.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
@@ -69,7 +69,6 @@ client = Spitch(
69
69
  response = client.speech.generate(
70
70
  language="yo",
71
71
  text="text",
72
- voice="sade",
73
72
  )
74
73
  ```
75
74
 
@@ -97,7 +96,6 @@ async def main() -> None:
97
96
  response = await client.speech.generate(
98
97
  language="yo",
99
98
  text="text",
100
- voice="sade",
101
99
  )
102
100
 
103
101
 
@@ -134,7 +132,6 @@ try:
134
132
  client.speech.generate(
135
133
  language="yo",
136
134
  text="text",
137
- voice="sade",
138
135
  )
139
136
  except spitch.APIConnectionError as e:
140
137
  print("The server could not be reached")
@@ -181,7 +178,6 @@ client = Spitch(
181
178
  client.with_options(max_retries=5).speech.generate(
182
179
  language="yo",
183
180
  text="text",
184
- voice="sade",
185
181
  )
186
182
  ```
187
183
 
@@ -208,7 +204,6 @@ client = Spitch(
208
204
  client.with_options(timeout=5.0).speech.generate(
209
205
  language="yo",
210
206
  text="text",
211
- voice="sade",
212
207
  )
213
208
  ```
214
209
 
@@ -251,7 +246,6 @@ client = Spitch()
251
246
  response = client.speech.with_raw_response.generate(
252
247
  language="yo",
253
248
  text="text",
254
- voice="sade",
255
249
  )
256
250
  print(response.headers.get('X-My-Header'))
257
251
 
@@ -273,7 +267,6 @@ To stream the response body, use `.with_streaming_response` instead, which requi
273
267
  with client.speech.with_streaming_response.generate(
274
268
  language="yo",
275
269
  text="text",
276
- voice="sade",
277
270
  ) as response:
278
271
  print(response.headers.get("X-My-Header"))
279
272
 
@@ -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=L0Aps0N-5x9tukfOzO2wIPVTHcOjnBjKtV6Pjx2jzIo,158
14
+ spitch/_version.py,sha256=EKcbWA9qeb0pohGt6XHLagbrKG7DUh3qW1G1Nfc9IiQ,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,14 +24,15 @@ 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=srpM1YYYJs0_TegHmnh0WSIoa1lIKBbOnZ18LKzZOD4,11357
28
- spitch/resources/text.py,sha256=xy7N1q5ioXVMtmcW6iOE8j8n9j4lvnpvO4jJ9FMZmsU,6071
29
- spitch/types/__init__.py,sha256=4ePk7asUYW79AqILx8fmOhFnMgUpWyMvkhZUbOpaaUA,367
30
- spitch/types/speech_generate_params.py,sha256=cZjZhlP9CIuwRQEnsAiBCurPEIlLgVBTYxx98hQViHg,417
27
+ spitch/resources/speech.py,sha256=reyeW_kABdUiJdB95F481VlRO5Tks7YUQ4mDclsLToA,11232
28
+ spitch/resources/text.py,sha256=qLvjdBZh1fBYkREWp5DCfIsuv7pvy3Kp209dU_D6QRY,9418
29
+ spitch/types/__init__.py,sha256=OwK9sWPMHvjfiRJk3URsxojngIiZ6dVZktL4Vi84QHk,445
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/speech_transcribe_params.py,sha256=FEG512EPDTm2WbDHefbn8tiSbnIqF8ZnFjc4rYekMRY,450
33
33
  spitch/types/text_tone_mark_params.py,sha256=63P5VElxanYkDP1ZLEuQt97JSgVpMCaAo4WRWLDvhlY,349
34
- spitch-1.7.0.dist-info/METADATA,sha256=VpNNdGB6_Uf7Revzl-lakCCojah4sKV4fkwBM4cGRHc,12645
35
- spitch-1.7.0.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
36
- spitch-1.7.0.dist-info/licenses/LICENSE,sha256=529F8Amq5MfoIm33JY544oweKES9vw9_xS1CNx-ztPI,11336
37
- spitch-1.7.0.dist-info/RECORD,,
34
+ spitch/types/text_translate_params.py,sha256=rU5hbTyBaP5L_akmgswHoNLcTKWN0Gz1kL1yt3EQL44,404
35
+ spitch-1.9.0.dist-info/METADATA,sha256=gZq2MAPE2y4ydBaWNtj5pdbBsgk_kP6LL3nwKSPfcVw,12511
36
+ spitch-1.9.0.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
37
+ spitch-1.9.0.dist-info/licenses/LICENSE,sha256=529F8Amq5MfoIm33JY544oweKES9vw9_xS1CNx-ztPI,11336
38
+ spitch-1.9.0.dist-info/RECORD,,
File without changes