spitch 0.0.7__py3-none-any.whl → 1.1.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.

@@ -0,0 +1,296 @@
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
7
+
8
+ import httpx
9
+
10
+ from ..types import speech_generate_params, speech_transcibe_params
11
+ from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven, FileTypes
12
+ from .._utils import (
13
+ maybe_transform,
14
+ async_maybe_transform,
15
+ )
16
+ from .._compat import cached_property
17
+ from .._resource import SyncAPIResource, AsyncAPIResource
18
+ from .._response import (
19
+ StreamedBinaryAPIResponse,
20
+ AsyncStreamedBinaryAPIResponse,
21
+ to_raw_response_wrapper,
22
+ to_streamed_response_wrapper,
23
+ async_to_raw_response_wrapper,
24
+ async_to_streamed_response_wrapper,
25
+ to_custom_streamed_response_wrapper,
26
+ async_to_custom_streamed_response_wrapper,
27
+ )
28
+ from .._base_client import make_request_options
29
+
30
+ __all__ = ["SpeechResource", "AsyncSpeechResource"]
31
+
32
+
33
+ class SpeechResource(SyncAPIResource):
34
+ @cached_property
35
+ def with_raw_response(self) -> SpeechResourceWithRawResponse:
36
+ """
37
+ This property can be used as a prefix for any HTTP method call to return the
38
+ the raw response object instead of the parsed content.
39
+
40
+ For more information, see https://www.github.com/spi-tch/spitch-python#accessing-raw-response-data-eg-headers
41
+ """
42
+ return SpeechResourceWithRawResponse(self)
43
+
44
+ @cached_property
45
+ def with_streaming_response(self) -> SpeechResourceWithStreamingResponse:
46
+ """
47
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
48
+
49
+ For more information, see https://www.github.com/spi-tch/spitch-python#with_streaming_response
50
+ """
51
+ return SpeechResourceWithStreamingResponse(self)
52
+
53
+ def generate(
54
+ self,
55
+ *,
56
+ language: Literal["yo", "en", "ha", "ig"],
57
+ text: str,
58
+ stream: bool | NotGiven = NOT_GIVEN,
59
+ voice: Literal["sade", "segun", "femi", "funmi"] | NotGiven = NOT_GIVEN,
60
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
61
+ # The extra values given here take precedence over values defined on the client or passed to this method.
62
+ extra_headers: Headers | None = None,
63
+ extra_query: Query | None = None,
64
+ extra_body: Body | None = None,
65
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
66
+ ) -> object:
67
+ """
68
+ Synthesize
69
+
70
+ Args:
71
+ extra_headers: Send extra headers
72
+
73
+ extra_query: Add additional query parameters to the request
74
+
75
+ extra_body: Add additional JSON properties to the request
76
+
77
+ timeout: Override the client-level default timeout for this request, in seconds
78
+ """
79
+ return self._post(
80
+ "/v1/speech",
81
+ body=maybe_transform(
82
+ {
83
+ "language": language,
84
+ "text": text,
85
+ "voice": voice,
86
+ },
87
+ speech_generate_params.SpeechGenerateParams,
88
+ ),
89
+ options=make_request_options(
90
+ extra_headers=extra_headers,
91
+ extra_query=extra_query,
92
+ extra_body=extra_body,
93
+ timeout=timeout,
94
+ query=maybe_transform({"stream": stream}, speech_generate_params.SpeechGenerateParams),
95
+ ),
96
+ cast_to=object,
97
+ )
98
+
99
+ def transcibe(
100
+ self,
101
+ *,
102
+ language: Literal["yo", "en", "ha", "ig"],
103
+ content: Optional[FileTypes] | NotGiven = NOT_GIVEN,
104
+ url: Optional[str] | NotGiven = NOT_GIVEN,
105
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
106
+ # The extra values given here take precedence over values defined on the client or passed to this method.
107
+ extra_headers: Headers | None = None,
108
+ extra_query: Query | None = None,
109
+ extra_body: Body | None = None,
110
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
111
+ ) -> object:
112
+ """
113
+ Transcribe
114
+
115
+ Args:
116
+ extra_headers: Send extra headers
117
+
118
+ extra_query: Add additional query parameters to the request
119
+
120
+ extra_body: Add additional JSON properties to the request
121
+
122
+ timeout: Override the client-level default timeout for this request, in seconds
123
+ """
124
+ return self._post(
125
+ "/v1/transcriptions",
126
+ body=maybe_transform(
127
+ {
128
+ "language": language,
129
+ "content": content,
130
+ "url": url,
131
+ },
132
+ speech_transcibe_params.SpeechTranscibeParams,
133
+ ),
134
+ options=make_request_options(
135
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
136
+ ),
137
+ cast_to=object,
138
+ )
139
+
140
+
141
+ class AsyncSpeechResource(AsyncAPIResource):
142
+ @cached_property
143
+ def with_raw_response(self) -> AsyncSpeechResourceWithRawResponse:
144
+ """
145
+ This property can be used as a prefix for any HTTP method call to return the
146
+ the raw response object instead of the parsed content.
147
+
148
+ For more information, see https://www.github.com/spi-tch/spitch-python#accessing-raw-response-data-eg-headers
149
+ """
150
+ return AsyncSpeechResourceWithRawResponse(self)
151
+
152
+ @cached_property
153
+ def with_streaming_response(self) -> AsyncSpeechResourceWithStreamingResponse:
154
+ """
155
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
156
+
157
+ For more information, see https://www.github.com/spi-tch/spitch-python#with_streaming_response
158
+ """
159
+ return AsyncSpeechResourceWithStreamingResponse(self)
160
+
161
+ async def generate(
162
+ self,
163
+ *,
164
+ language: Literal["yo", "en", "ha", "ig"],
165
+ text: str,
166
+ stream: bool | NotGiven = NOT_GIVEN,
167
+ voice: Literal["sade", "segun", "femi", "funmi"] | NotGiven = NOT_GIVEN,
168
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
169
+ # The extra values given here take precedence over values defined on the client or passed to this method.
170
+ extra_headers: Headers | None = None,
171
+ extra_query: Query | None = None,
172
+ extra_body: Body | None = None,
173
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
174
+ ) -> object:
175
+ """
176
+ Synthesize
177
+
178
+ Args:
179
+ extra_headers: Send extra headers
180
+
181
+ extra_query: Add additional query parameters to the request
182
+
183
+ extra_body: Add additional JSON properties to the request
184
+
185
+ timeout: Override the client-level default timeout for this request, in seconds
186
+ """
187
+ return await self._post(
188
+ "/v1/speech",
189
+ body=await async_maybe_transform(
190
+ {
191
+ "language": language,
192
+ "text": text,
193
+ "voice": voice,
194
+ },
195
+ speech_generate_params.SpeechGenerateParams,
196
+ ),
197
+ options=make_request_options(
198
+ extra_headers=extra_headers,
199
+ extra_query=extra_query,
200
+ extra_body=extra_body,
201
+ timeout=timeout,
202
+ query=await async_maybe_transform({"stream": stream}, speech_generate_params.SpeechGenerateParams),
203
+ ),
204
+ cast_to=object,
205
+ )
206
+
207
+ async def transcibe(
208
+ self,
209
+ *,
210
+ language: Literal["yo", "en", "ha", "ig"],
211
+ content: Optional[FileTypes] | NotGiven = NOT_GIVEN,
212
+ url: Optional[str] | NotGiven = NOT_GIVEN,
213
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
214
+ # The extra values given here take precedence over values defined on the client or passed to this method.
215
+ extra_headers: Headers | None = None,
216
+ extra_query: Query | None = None,
217
+ extra_body: Body | None = None,
218
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
219
+ ) -> object:
220
+ """
221
+ Transcribe
222
+
223
+ Args:
224
+ extra_headers: Send extra headers
225
+
226
+ extra_query: Add additional query parameters to the request
227
+
228
+ extra_body: Add additional JSON properties to the request
229
+
230
+ timeout: Override the client-level default timeout for this request, in seconds
231
+ """
232
+ return await self._post(
233
+ "/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
+ ),
242
+ options=make_request_options(
243
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
244
+ ),
245
+ cast_to=object,
246
+ )
247
+
248
+
249
+ class SpeechResourceWithRawResponse:
250
+ def __init__(self, speech: SpeechResource) -> None:
251
+ self._speech = speech
252
+
253
+ self.generate = to_raw_response_wrapper(
254
+ speech.generate,
255
+ )
256
+ self.transcibe = to_raw_response_wrapper(
257
+ speech.transcibe,
258
+ )
259
+
260
+
261
+ class AsyncSpeechResourceWithRawResponse:
262
+ def __init__(self, speech: AsyncSpeechResource) -> None:
263
+ self._speech = speech
264
+
265
+ self.generate = async_to_raw_response_wrapper(
266
+ speech.generate,
267
+ )
268
+ self.transcibe = async_to_raw_response_wrapper(
269
+ speech.transcibe,
270
+ )
271
+
272
+
273
+ class SpeechResourceWithStreamingResponse:
274
+ def __init__(self, speech: SpeechResource) -> None:
275
+ self._speech = speech
276
+
277
+ self.generate = to_custom_streamed_response_wrapper(
278
+ speech.generate,
279
+ StreamedBinaryAPIResponse
280
+ )
281
+ self.transcibe = to_streamed_response_wrapper(
282
+ speech.transcibe,
283
+ )
284
+
285
+
286
+ class AsyncSpeechResourceWithStreamingResponse:
287
+ def __init__(self, speech: AsyncSpeechResource) -> None:
288
+ self._speech = speech
289
+
290
+ self.generate = async_to_custom_streamed_response_wrapper(
291
+ speech.generate,
292
+ AsyncStreamedBinaryAPIResponse
293
+ )
294
+ self.transcibe = async_to_streamed_response_wrapper(
295
+ speech.transcibe,
296
+ )
@@ -0,0 +1,181 @@
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
6
+
7
+ import httpx
8
+
9
+ from ..types import text_tone_mark_params
10
+ from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
11
+ from .._utils import (
12
+ maybe_transform,
13
+ async_maybe_transform,
14
+ )
15
+ from .._compat import cached_property
16
+ from .._resource import SyncAPIResource, AsyncAPIResource
17
+ from .._response import (
18
+ to_raw_response_wrapper,
19
+ to_streamed_response_wrapper,
20
+ async_to_raw_response_wrapper,
21
+ async_to_streamed_response_wrapper,
22
+ )
23
+ from .._base_client import make_request_options
24
+
25
+ __all__ = ["TextResource", "AsyncTextResource"]
26
+
27
+
28
+ class TextResource(SyncAPIResource):
29
+ @cached_property
30
+ def with_raw_response(self) -> TextResourceWithRawResponse:
31
+ """
32
+ This property can be used as a prefix for any HTTP method call to return the
33
+ the raw response object instead of the parsed content.
34
+
35
+ For more information, see https://www.github.com/spi-tch/spitch-python#accessing-raw-response-data-eg-headers
36
+ """
37
+ return TextResourceWithRawResponse(self)
38
+
39
+ @cached_property
40
+ def with_streaming_response(self) -> TextResourceWithStreamingResponse:
41
+ """
42
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
43
+
44
+ For more information, see https://www.github.com/spi-tch/spitch-python#with_streaming_response
45
+ """
46
+ return TextResourceWithStreamingResponse(self)
47
+
48
+ def tone_mark(
49
+ self,
50
+ *,
51
+ language: Literal["yo", "en", "ha", "ig"],
52
+ text: str,
53
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
54
+ # The extra values given here take precedence over values defined on the client or passed to this method.
55
+ extra_headers: Headers | None = None,
56
+ extra_query: Query | None = None,
57
+ extra_body: Body | None = None,
58
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
59
+ ) -> object:
60
+ """
61
+ Tone Mark
62
+
63
+ Args:
64
+ extra_headers: Send extra headers
65
+
66
+ extra_query: Add additional query parameters to the request
67
+
68
+ extra_body: Add additional JSON properties to the request
69
+
70
+ timeout: Override the client-level default timeout for this request, in seconds
71
+ """
72
+ return self._post(
73
+ "/v1/diacritics",
74
+ body=maybe_transform(
75
+ {
76
+ "language": language,
77
+ "text": text,
78
+ },
79
+ text_tone_mark_params.TextToneMarkParams,
80
+ ),
81
+ options=make_request_options(
82
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
83
+ ),
84
+ cast_to=object,
85
+ )
86
+
87
+
88
+ class AsyncTextResource(AsyncAPIResource):
89
+ @cached_property
90
+ def with_raw_response(self) -> AsyncTextResourceWithRawResponse:
91
+ """
92
+ This property can be used as a prefix for any HTTP method call to return the
93
+ the raw response object instead of the parsed content.
94
+
95
+ For more information, see https://www.github.com/spi-tch/spitch-python#accessing-raw-response-data-eg-headers
96
+ """
97
+ return AsyncTextResourceWithRawResponse(self)
98
+
99
+ @cached_property
100
+ def with_streaming_response(self) -> AsyncTextResourceWithStreamingResponse:
101
+ """
102
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
103
+
104
+ For more information, see https://www.github.com/spi-tch/spitch-python#with_streaming_response
105
+ """
106
+ return AsyncTextResourceWithStreamingResponse(self)
107
+
108
+ async def tone_mark(
109
+ self,
110
+ *,
111
+ language: Literal["yo", "en", "ha", "ig"],
112
+ text: str,
113
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
114
+ # The extra values given here take precedence over values defined on the client or passed to this method.
115
+ extra_headers: Headers | None = None,
116
+ extra_query: Query | None = None,
117
+ extra_body: Body | None = None,
118
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
119
+ ) -> object:
120
+ """
121
+ Tone Mark
122
+
123
+ Args:
124
+ extra_headers: Send extra headers
125
+
126
+ extra_query: Add additional query parameters to the request
127
+
128
+ extra_body: Add additional JSON properties to the request
129
+
130
+ timeout: Override the client-level default timeout for this request, in seconds
131
+ """
132
+ return await self._post(
133
+ "/v1/diacritics",
134
+ body=await async_maybe_transform(
135
+ {
136
+ "language": language,
137
+ "text": text,
138
+ },
139
+ text_tone_mark_params.TextToneMarkParams,
140
+ ),
141
+ options=make_request_options(
142
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
143
+ ),
144
+ cast_to=object,
145
+ )
146
+
147
+
148
+ class TextResourceWithRawResponse:
149
+ def __init__(self, text: TextResource) -> None:
150
+ self._text = text
151
+
152
+ self.tone_mark = to_raw_response_wrapper(
153
+ text.tone_mark,
154
+ )
155
+
156
+
157
+ class AsyncTextResourceWithRawResponse:
158
+ def __init__(self, text: AsyncTextResource) -> None:
159
+ self._text = text
160
+
161
+ self.tone_mark = async_to_raw_response_wrapper(
162
+ text.tone_mark,
163
+ )
164
+
165
+
166
+ class TextResourceWithStreamingResponse:
167
+ def __init__(self, text: TextResource) -> None:
168
+ self._text = text
169
+
170
+ self.tone_mark = to_streamed_response_wrapper(
171
+ text.tone_mark,
172
+ )
173
+
174
+
175
+ class AsyncTextResourceWithStreamingResponse:
176
+ def __init__(self, text: AsyncTextResource) -> None:
177
+ self._text = text
178
+
179
+ self.tone_mark = async_to_streamed_response_wrapper(
180
+ text.tone_mark,
181
+ )
@@ -0,0 +1,7 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from .text_tone_mark_params import TextToneMarkParams as TextToneMarkParams
6
+ from .speech_generate_params import SpeechGenerateParams as SpeechGenerateParams
7
+ from .speech_transcibe_params import SpeechTranscibeParams as SpeechTranscibeParams
@@ -0,0 +1,17 @@
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__ = ["SpeechGenerateParams"]
8
+
9
+
10
+ class SpeechGenerateParams(TypedDict, total=False):
11
+ language: Required[Literal["yo", "en", "ha", "ig"]]
12
+
13
+ text: Required[str]
14
+
15
+ stream: bool
16
+
17
+ voice: Literal["sade", "segun", "femi", "funmi"]
@@ -0,0 +1,18 @@
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]
@@ -0,0 +1,13 @@
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__ = ["TextToneMarkParams"]
8
+
9
+
10
+ class TextToneMarkParams(TypedDict, total=False):
11
+ language: Required[Literal["yo", "en", "ha", "ig"]]
12
+
13
+ text: Required[str]