spitch 1.0.0__tar.gz → 1.2.0__tar.gz
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-1.2.0/.release-please-manifest.json +3 -0
- {spitch-1.0.0 → spitch-1.2.0}/CHANGELOG.md +23 -0
- {spitch-1.0.0 → spitch-1.2.0}/PKG-INFO +1 -1
- spitch-1.2.0/examples/example.py +27 -0
- {spitch-1.0.0 → spitch-1.2.0}/pyproject.toml +1 -1
- {spitch-1.0.0 → spitch-1.2.0}/src/spitch/_version.py +1 -1
- {spitch-1.0.0 → spitch-1.2.0}/src/spitch/resources/speech.py +39 -19
- spitch-1.0.0/.release-please-manifest.json +0 -3
- spitch-1.0.0/examples/example.py +0 -13
- {spitch-1.0.0 → spitch-1.2.0}/.gitignore +0 -0
- {spitch-1.0.0 → spitch-1.2.0}/CONTRIBUTING.md +0 -0
- {spitch-1.0.0 → spitch-1.2.0}/LICENSE +0 -0
- {spitch-1.0.0 → spitch-1.2.0}/README.md +0 -0
- {spitch-1.0.0 → spitch-1.2.0}/SECURITY.md +0 -0
- {spitch-1.0.0 → spitch-1.2.0}/api.md +0 -0
- {spitch-1.0.0 → spitch-1.2.0}/bin/check-release-environment +0 -0
- {spitch-1.0.0 → spitch-1.2.0}/bin/publish-pypi +0 -0
- {spitch-1.0.0 → spitch-1.2.0}/examples/.keep +0 -0
- {spitch-1.0.0 → spitch-1.2.0}/mypy.ini +0 -0
- {spitch-1.0.0 → spitch-1.2.0}/noxfile.py +0 -0
- {spitch-1.0.0 → spitch-1.2.0}/release-please-config.json +0 -0
- {spitch-1.0.0 → spitch-1.2.0}/requirements-dev.lock +0 -0
- {spitch-1.0.0 → spitch-1.2.0}/requirements.lock +0 -0
- {spitch-1.0.0 → spitch-1.2.0}/src/spitch/__init__.py +0 -0
- {spitch-1.0.0 → spitch-1.2.0}/src/spitch/_base_client.py +0 -0
- {spitch-1.0.0 → spitch-1.2.0}/src/spitch/_client.py +0 -0
- {spitch-1.0.0 → spitch-1.2.0}/src/spitch/_compat.py +0 -0
- {spitch-1.0.0 → spitch-1.2.0}/src/spitch/_constants.py +0 -0
- {spitch-1.0.0 → spitch-1.2.0}/src/spitch/_exceptions.py +0 -0
- {spitch-1.0.0 → spitch-1.2.0}/src/spitch/_files.py +0 -0
- {spitch-1.0.0 → spitch-1.2.0}/src/spitch/_models.py +0 -0
- {spitch-1.0.0 → spitch-1.2.0}/src/spitch/_qs.py +0 -0
- {spitch-1.0.0 → spitch-1.2.0}/src/spitch/_resource.py +0 -0
- {spitch-1.0.0 → spitch-1.2.0}/src/spitch/_response.py +0 -0
- {spitch-1.0.0 → spitch-1.2.0}/src/spitch/_streaming.py +0 -0
- {spitch-1.0.0 → spitch-1.2.0}/src/spitch/_types.py +0 -0
- {spitch-1.0.0 → spitch-1.2.0}/src/spitch/_utils/__init__.py +0 -0
- {spitch-1.0.0 → spitch-1.2.0}/src/spitch/_utils/_logs.py +0 -0
- {spitch-1.0.0 → spitch-1.2.0}/src/spitch/_utils/_proxy.py +0 -0
- {spitch-1.0.0 → spitch-1.2.0}/src/spitch/_utils/_reflection.py +0 -0
- {spitch-1.0.0 → spitch-1.2.0}/src/spitch/_utils/_streams.py +0 -0
- {spitch-1.0.0 → spitch-1.2.0}/src/spitch/_utils/_sync.py +0 -0
- {spitch-1.0.0 → spitch-1.2.0}/src/spitch/_utils/_transform.py +0 -0
- {spitch-1.0.0 → spitch-1.2.0}/src/spitch/_utils/_typing.py +0 -0
- {spitch-1.0.0 → spitch-1.2.0}/src/spitch/_utils/_utils.py +0 -0
- {spitch-1.0.0 → spitch-1.2.0}/src/spitch/lib/.keep +0 -0
- {spitch-1.0.0 → spitch-1.2.0}/src/spitch/py.typed +0 -0
- {spitch-1.0.0 → spitch-1.2.0}/src/spitch/resources/__init__.py +0 -0
- {spitch-1.0.0 → spitch-1.2.0}/src/spitch/resources/text.py +0 -0
- {spitch-1.0.0 → spitch-1.2.0}/src/spitch/types/__init__.py +0 -0
- {spitch-1.0.0 → spitch-1.2.0}/src/spitch/types/speech_generate_params.py +0 -0
- {spitch-1.0.0 → spitch-1.2.0}/src/spitch/types/speech_transcibe_params.py +0 -0
- {spitch-1.0.0 → spitch-1.2.0}/src/spitch/types/text_tone_mark_params.py +0 -0
- {spitch-1.0.0 → spitch-1.2.0}/tests/__init__.py +0 -0
- {spitch-1.0.0 → spitch-1.2.0}/tests/api_resources/__init__.py +0 -0
- {spitch-1.0.0 → spitch-1.2.0}/tests/api_resources/test_speech.py +0 -0
- {spitch-1.0.0 → spitch-1.2.0}/tests/api_resources/test_text.py +0 -0
- {spitch-1.0.0 → spitch-1.2.0}/tests/conftest.py +0 -0
- {spitch-1.0.0 → spitch-1.2.0}/tests/sample_file.txt +0 -0
- {spitch-1.0.0 → spitch-1.2.0}/tests/test_client.py +0 -0
- {spitch-1.0.0 → spitch-1.2.0}/tests/test_deepcopy.py +0 -0
- {spitch-1.0.0 → spitch-1.2.0}/tests/test_extract_files.py +0 -0
- {spitch-1.0.0 → spitch-1.2.0}/tests/test_files.py +0 -0
- {spitch-1.0.0 → spitch-1.2.0}/tests/test_models.py +0 -0
- {spitch-1.0.0 → spitch-1.2.0}/tests/test_qs.py +0 -0
- {spitch-1.0.0 → spitch-1.2.0}/tests/test_required_args.py +0 -0
- {spitch-1.0.0 → spitch-1.2.0}/tests/test_response.py +0 -0
- {spitch-1.0.0 → spitch-1.2.0}/tests/test_streaming.py +0 -0
- {spitch-1.0.0 → spitch-1.2.0}/tests/test_transform.py +0 -0
- {spitch-1.0.0 → spitch-1.2.0}/tests/test_utils/test_proxy.py +0 -0
- {spitch-1.0.0 → spitch-1.2.0}/tests/test_utils/test_typing.py +0 -0
- {spitch-1.0.0 → spitch-1.2.0}/tests/utils.py +0 -0
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.2.0 (2024-10-07)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v1.1.0...v1.2.0](https://github.com/spi-tch/spitch-python/compare/v1.1.0...v1.2.0)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
* **api:** update via SDK Studio ([#13](https://github.com/spi-tch/spitch-python/issues/13)) ([fdb3beb](https://github.com/spi-tch/spitch-python/commit/fdb3bebe5701a188e2c4f62a3a6d2e72c267532c))
|
|
10
|
+
|
|
11
|
+
## 1.1.0 (2024-10-07)
|
|
12
|
+
|
|
13
|
+
Full Changelog: [v1.0.0...v1.1.0](https://github.com/spi-tch/spitch-python/compare/v1.0.0...v1.1.0)
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* commits ([e741720](https://github.com/spi-tch/spitch-python/commit/e74172090c8a263621ef44d67d4aa8db973526f8))
|
|
18
|
+
* commits ([f3fecf7](https://github.com/spi-tch/spitch-python/commit/f3fecf7635f8d20747c4f7ed09687a3d0050dd67))
|
|
19
|
+
* commits ([50e3396](https://github.com/spi-tch/spitch-python/commit/50e339659a24e1c9c74f604301992fc6071c31f6))
|
|
20
|
+
* commits ([ce1277c](https://github.com/spi-tch/spitch-python/commit/ce1277c1c951918182e1b7f79408287a96f974c9))
|
|
21
|
+
* commits ([d623a03](https://github.com/spi-tch/spitch-python/commit/d623a03efb0eb839fc17e10069d4238f14994c59))
|
|
22
|
+
* commits ([b3eb065](https://github.com/spi-tch/spitch-python/commit/b3eb06504bd4b81fb269df7b2cb2b97b70579c47))
|
|
23
|
+
* commits ([b79d3d2](https://github.com/spi-tch/spitch-python/commit/b79d3d24dd3679f94079b963a809f62342513e23))
|
|
24
|
+
* commits ([c546c4b](https://github.com/spi-tch/spitch-python/commit/c546c4bafe7fc28df4e22b423d7aae0d0d2ddc95))
|
|
25
|
+
|
|
3
26
|
## 1.0.0 (2024-10-07)
|
|
4
27
|
|
|
5
28
|
Full Changelog: [v0.0.1-alpha.0...v1.0.0](https://github.com/spi-tch/spitch-python/compare/v0.0.1-alpha.0...v1.0.0)
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env -S rye run python
|
|
2
|
+
import os
|
|
3
|
+
import time
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
from spitch import Spitch
|
|
7
|
+
|
|
8
|
+
client = Spitch(api_key=os.getenv('SPITCH_API_KEY'))
|
|
9
|
+
speech_file_path = Path(__file__).parent / "speech.mp3"
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def main() -> None:
|
|
13
|
+
start_time = time.time()
|
|
14
|
+
with client.speech.with_streaming_response.generate(
|
|
15
|
+
language="yo",
|
|
16
|
+
text="Bawo ni ololufe?"
|
|
17
|
+
) as speech:
|
|
18
|
+
print(f"Time to first byte: {int((time.time() - start_time) * 1000)}ms")
|
|
19
|
+
speech.stream_to_file(speech_file_path)
|
|
20
|
+
|
|
21
|
+
# transcribe
|
|
22
|
+
response = client.speech.transcibe(language="yo", content=speech_file_path)
|
|
23
|
+
print(type(response))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
if __name__ == "__main__":
|
|
27
|
+
main()
|
|
@@ -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 =
|
|
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 =
|
|
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,
|
spitch-1.0.0/examples/example.py
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env -S rye run python
|
|
2
|
-
|
|
3
|
-
from spitch import Spitch
|
|
4
|
-
|
|
5
|
-
client = Spitch(
|
|
6
|
-
client_id="My Client ID",
|
|
7
|
-
client_secret="My Client Secret",
|
|
8
|
-
token_url="My Token URL",
|
|
9
|
-
)
|
|
10
|
-
transcription = client.transcriptions.create(
|
|
11
|
-
language="yo",
|
|
12
|
-
)
|
|
13
|
-
print(transcription)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|