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