spitch 1.32.0__tar.gz → 1.33.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.33.0/.release-please-manifest.json +3 -0
- {spitch-1.32.0 → spitch-1.33.0}/CHANGELOG.md +8 -0
- {spitch-1.32.0 → spitch-1.33.0}/PKG-INFO +1 -1
- {spitch-1.32.0 → spitch-1.33.0}/api.md +1 -1
- {spitch-1.32.0 → spitch-1.33.0}/pyproject.toml +1 -1
- {spitch-1.32.0 → spitch-1.33.0}/src/spitch/_version.py +1 -1
- {spitch-1.32.0 → spitch-1.33.0}/src/spitch/resources/speech.py +22 -8
- {spitch-1.32.0 → spitch-1.33.0}/tests/api_resources/test_speech.py +74 -34
- spitch-1.32.0/.release-please-manifest.json +0 -3
- {spitch-1.32.0 → spitch-1.33.0}/.gitignore +0 -0
- {spitch-1.32.0 → spitch-1.33.0}/CONTRIBUTING.md +0 -0
- {spitch-1.32.0 → spitch-1.33.0}/LICENSE +0 -0
- {spitch-1.32.0 → spitch-1.33.0}/README.md +0 -0
- {spitch-1.32.0 → spitch-1.33.0}/SECURITY.md +0 -0
- {spitch-1.32.0 → spitch-1.33.0}/bin/check-release-environment +0 -0
- {spitch-1.32.0 → spitch-1.33.0}/bin/publish-pypi +0 -0
- {spitch-1.32.0 → spitch-1.33.0}/examples/.keep +0 -0
- {spitch-1.32.0 → spitch-1.33.0}/examples/example.py +0 -0
- {spitch-1.32.0 → spitch-1.33.0}/mypy.ini +0 -0
- {spitch-1.32.0 → spitch-1.33.0}/noxfile.py +0 -0
- {spitch-1.32.0 → spitch-1.33.0}/release-please-config.json +0 -0
- {spitch-1.32.0 → spitch-1.33.0}/requirements-dev.lock +0 -0
- {spitch-1.32.0 → spitch-1.33.0}/requirements.lock +0 -0
- {spitch-1.32.0 → spitch-1.33.0}/src/spitch/__init__.py +0 -0
- {spitch-1.32.0 → spitch-1.33.0}/src/spitch/_base_client.py +0 -0
- {spitch-1.32.0 → spitch-1.33.0}/src/spitch/_client.py +0 -0
- {spitch-1.32.0 → spitch-1.33.0}/src/spitch/_compat.py +0 -0
- {spitch-1.32.0 → spitch-1.33.0}/src/spitch/_constants.py +0 -0
- {spitch-1.32.0 → spitch-1.33.0}/src/spitch/_exceptions.py +0 -0
- {spitch-1.32.0 → spitch-1.33.0}/src/spitch/_files.py +0 -0
- {spitch-1.32.0 → spitch-1.33.0}/src/spitch/_models.py +0 -0
- {spitch-1.32.0 → spitch-1.33.0}/src/spitch/_qs.py +0 -0
- {spitch-1.32.0 → spitch-1.33.0}/src/spitch/_resource.py +0 -0
- {spitch-1.32.0 → spitch-1.33.0}/src/spitch/_response.py +0 -0
- {spitch-1.32.0 → spitch-1.33.0}/src/spitch/_streaming.py +0 -0
- {spitch-1.32.0 → spitch-1.33.0}/src/spitch/_types.py +0 -0
- {spitch-1.32.0 → spitch-1.33.0}/src/spitch/_utils/__init__.py +0 -0
- {spitch-1.32.0 → spitch-1.33.0}/src/spitch/_utils/_logs.py +0 -0
- {spitch-1.32.0 → spitch-1.33.0}/src/spitch/_utils/_proxy.py +0 -0
- {spitch-1.32.0 → spitch-1.33.0}/src/spitch/_utils/_reflection.py +0 -0
- {spitch-1.32.0 → spitch-1.33.0}/src/spitch/_utils/_resources_proxy.py +0 -0
- {spitch-1.32.0 → spitch-1.33.0}/src/spitch/_utils/_streams.py +0 -0
- {spitch-1.32.0 → spitch-1.33.0}/src/spitch/_utils/_sync.py +0 -0
- {spitch-1.32.0 → spitch-1.33.0}/src/spitch/_utils/_transform.py +0 -0
- {spitch-1.32.0 → spitch-1.33.0}/src/spitch/_utils/_typing.py +0 -0
- {spitch-1.32.0 → spitch-1.33.0}/src/spitch/_utils/_utils.py +0 -0
- {spitch-1.32.0 → spitch-1.33.0}/src/spitch/lib/.keep +0 -0
- {spitch-1.32.0 → spitch-1.33.0}/src/spitch/py.typed +0 -0
- {spitch-1.32.0 → spitch-1.33.0}/src/spitch/resources/__init__.py +0 -0
- {spitch-1.32.0 → spitch-1.33.0}/src/spitch/resources/text.py +0 -0
- {spitch-1.32.0 → spitch-1.33.0}/src/spitch/types/__init__.py +0 -0
- {spitch-1.32.0 → spitch-1.33.0}/src/spitch/types/speech_generate_params.py +0 -0
- {spitch-1.32.0 → spitch-1.33.0}/src/spitch/types/speech_transcribe_params.py +0 -0
- {spitch-1.32.0 → spitch-1.33.0}/src/spitch/types/speech_transcribe_response.py +0 -0
- {spitch-1.32.0 → spitch-1.33.0}/src/spitch/types/text_tone_mark_params.py +0 -0
- {spitch-1.32.0 → spitch-1.33.0}/src/spitch/types/text_tone_mark_response.py +0 -0
- {spitch-1.32.0 → spitch-1.33.0}/src/spitch/types/text_translate_params.py +0 -0
- {spitch-1.32.0 → spitch-1.33.0}/src/spitch/types/text_translate_response.py +0 -0
- {spitch-1.32.0 → spitch-1.33.0}/tests/__init__.py +0 -0
- {spitch-1.32.0 → spitch-1.33.0}/tests/api_resources/__init__.py +0 -0
- {spitch-1.32.0 → spitch-1.33.0}/tests/api_resources/test_text.py +0 -0
- {spitch-1.32.0 → spitch-1.33.0}/tests/conftest.py +0 -0
- {spitch-1.32.0 → spitch-1.33.0}/tests/sample_file.txt +0 -0
- {spitch-1.32.0 → spitch-1.33.0}/tests/test_client.py +0 -0
- {spitch-1.32.0 → spitch-1.33.0}/tests/test_deepcopy.py +0 -0
- {spitch-1.32.0 → spitch-1.33.0}/tests/test_extract_files.py +0 -0
- {spitch-1.32.0 → spitch-1.33.0}/tests/test_files.py +0 -0
- {spitch-1.32.0 → spitch-1.33.0}/tests/test_models.py +0 -0
- {spitch-1.32.0 → spitch-1.33.0}/tests/test_qs.py +0 -0
- {spitch-1.32.0 → spitch-1.33.0}/tests/test_required_args.py +0 -0
- {spitch-1.32.0 → spitch-1.33.0}/tests/test_response.py +0 -0
- {spitch-1.32.0 → spitch-1.33.0}/tests/test_streaming.py +0 -0
- {spitch-1.32.0 → spitch-1.33.0}/tests/test_transform.py +0 -0
- {spitch-1.32.0 → spitch-1.33.0}/tests/test_utils/test_proxy.py +0 -0
- {spitch-1.32.0 → spitch-1.33.0}/tests/test_utils/test_typing.py +0 -0
- {spitch-1.32.0 → spitch-1.33.0}/tests/utils.py +0 -0
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.33.0 (2025-08-02)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v1.32.0...v1.33.0](https://github.com/spi-tch/spitch-python/compare/v1.32.0...v1.33.0)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
* **api:** update via SDK Studio ([9d14152](https://github.com/spi-tch/spitch-python/commit/9d14152165cda3b68febf16ccd6d7c662420db76))
|
|
10
|
+
|
|
3
11
|
## 1.32.0 (2025-08-02)
|
|
4
12
|
|
|
5
13
|
Full Changelog: [v1.31.0...v1.32.0](https://github.com/spi-tch/spitch-python/compare/v1.31.0...v1.32.0)
|
|
@@ -8,7 +8,7 @@ from spitch.types import SpeechTranscribeResponse
|
|
|
8
8
|
|
|
9
9
|
Methods:
|
|
10
10
|
|
|
11
|
-
- <code title="post /v1/speech">client.speech.<a href="./src/spitch/resources/speech.py">generate</a>(\*\*<a href="src/spitch/types/speech_generate_params.py">params</a>) ->
|
|
11
|
+
- <code title="post /v1/speech">client.speech.<a href="./src/spitch/resources/speech.py">generate</a>(\*\*<a href="src/spitch/types/speech_generate_params.py">params</a>) -> BinaryAPIResponse</code>
|
|
12
12
|
- <code title="post /v1/transcriptions">client.speech.<a href="./src/spitch/resources/speech.py">transcribe</a>(\*\*<a href="src/spitch/types/speech_transcribe_params.py">params</a>) -> <a href="./src/spitch/types/speech_transcribe_response.py">SpeechTranscribeResponse</a></code>
|
|
13
13
|
|
|
14
14
|
# Text
|
|
@@ -13,10 +13,18 @@ from .._utils import extract_files, maybe_transform, deepcopy_minimal, async_may
|
|
|
13
13
|
from .._compat import cached_property
|
|
14
14
|
from .._resource import SyncAPIResource, AsyncAPIResource
|
|
15
15
|
from .._response import (
|
|
16
|
+
BinaryAPIResponse,
|
|
17
|
+
AsyncBinaryAPIResponse,
|
|
18
|
+
StreamedBinaryAPIResponse,
|
|
19
|
+
AsyncStreamedBinaryAPIResponse,
|
|
16
20
|
to_raw_response_wrapper,
|
|
17
21
|
to_streamed_response_wrapper,
|
|
18
22
|
async_to_raw_response_wrapper,
|
|
23
|
+
to_custom_raw_response_wrapper,
|
|
19
24
|
async_to_streamed_response_wrapper,
|
|
25
|
+
to_custom_streamed_response_wrapper,
|
|
26
|
+
async_to_custom_raw_response_wrapper,
|
|
27
|
+
async_to_custom_streamed_response_wrapper,
|
|
20
28
|
)
|
|
21
29
|
from .._base_client import make_request_options
|
|
22
30
|
from ..types.speech_transcribe_response import SpeechTranscribeResponse
|
|
@@ -80,7 +88,7 @@ class SpeechResource(SyncAPIResource):
|
|
|
80
88
|
extra_query: Query | None = None,
|
|
81
89
|
extra_body: Body | None = None,
|
|
82
90
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
83
|
-
) ->
|
|
91
|
+
) -> BinaryAPIResponse:
|
|
84
92
|
"""
|
|
85
93
|
Synthesize
|
|
86
94
|
|
|
@@ -93,6 +101,7 @@ class SpeechResource(SyncAPIResource):
|
|
|
93
101
|
|
|
94
102
|
timeout: Override the client-level default timeout for this request, in seconds
|
|
95
103
|
"""
|
|
104
|
+
extra_headers = {"Accept": "audio/wav", **(extra_headers or {})}
|
|
96
105
|
return self._post(
|
|
97
106
|
"/v1/speech",
|
|
98
107
|
body=maybe_transform(
|
|
@@ -107,7 +116,7 @@ class SpeechResource(SyncAPIResource):
|
|
|
107
116
|
options=make_request_options(
|
|
108
117
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
109
118
|
),
|
|
110
|
-
cast_to=
|
|
119
|
+
cast_to=BinaryAPIResponse,
|
|
111
120
|
)
|
|
112
121
|
|
|
113
122
|
def transcribe(
|
|
@@ -220,7 +229,7 @@ class AsyncSpeechResource(AsyncAPIResource):
|
|
|
220
229
|
extra_query: Query | None = None,
|
|
221
230
|
extra_body: Body | None = None,
|
|
222
231
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
223
|
-
) ->
|
|
232
|
+
) -> AsyncBinaryAPIResponse:
|
|
224
233
|
"""
|
|
225
234
|
Synthesize
|
|
226
235
|
|
|
@@ -233,6 +242,7 @@ class AsyncSpeechResource(AsyncAPIResource):
|
|
|
233
242
|
|
|
234
243
|
timeout: Override the client-level default timeout for this request, in seconds
|
|
235
244
|
"""
|
|
245
|
+
extra_headers = {"Accept": "audio/wav", **(extra_headers or {})}
|
|
236
246
|
return await self._post(
|
|
237
247
|
"/v1/speech",
|
|
238
248
|
body=await async_maybe_transform(
|
|
@@ -247,7 +257,7 @@ class AsyncSpeechResource(AsyncAPIResource):
|
|
|
247
257
|
options=make_request_options(
|
|
248
258
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
249
259
|
),
|
|
250
|
-
cast_to=
|
|
260
|
+
cast_to=AsyncBinaryAPIResponse,
|
|
251
261
|
)
|
|
252
262
|
|
|
253
263
|
async def transcribe(
|
|
@@ -308,8 +318,9 @@ class SpeechResourceWithRawResponse:
|
|
|
308
318
|
def __init__(self, speech: SpeechResource) -> None:
|
|
309
319
|
self._speech = speech
|
|
310
320
|
|
|
311
|
-
self.generate =
|
|
321
|
+
self.generate = to_custom_raw_response_wrapper(
|
|
312
322
|
speech.generate,
|
|
323
|
+
BinaryAPIResponse,
|
|
313
324
|
)
|
|
314
325
|
self.transcribe = to_raw_response_wrapper(
|
|
315
326
|
speech.transcribe,
|
|
@@ -320,8 +331,9 @@ class AsyncSpeechResourceWithRawResponse:
|
|
|
320
331
|
def __init__(self, speech: AsyncSpeechResource) -> None:
|
|
321
332
|
self._speech = speech
|
|
322
333
|
|
|
323
|
-
self.generate =
|
|
334
|
+
self.generate = async_to_custom_raw_response_wrapper(
|
|
324
335
|
speech.generate,
|
|
336
|
+
AsyncBinaryAPIResponse,
|
|
325
337
|
)
|
|
326
338
|
self.transcribe = async_to_raw_response_wrapper(
|
|
327
339
|
speech.transcribe,
|
|
@@ -332,8 +344,9 @@ class SpeechResourceWithStreamingResponse:
|
|
|
332
344
|
def __init__(self, speech: SpeechResource) -> None:
|
|
333
345
|
self._speech = speech
|
|
334
346
|
|
|
335
|
-
self.generate =
|
|
347
|
+
self.generate = to_custom_streamed_response_wrapper(
|
|
336
348
|
speech.generate,
|
|
349
|
+
StreamedBinaryAPIResponse,
|
|
337
350
|
)
|
|
338
351
|
self.transcribe = to_streamed_response_wrapper(
|
|
339
352
|
speech.transcribe,
|
|
@@ -344,8 +357,9 @@ class AsyncSpeechResourceWithStreamingResponse:
|
|
|
344
357
|
def __init__(self, speech: AsyncSpeechResource) -> None:
|
|
345
358
|
self._speech = speech
|
|
346
359
|
|
|
347
|
-
self.generate =
|
|
360
|
+
self.generate = async_to_custom_streamed_response_wrapper(
|
|
348
361
|
speech.generate,
|
|
362
|
+
AsyncStreamedBinaryAPIResponse,
|
|
349
363
|
)
|
|
350
364
|
self.transcribe = async_to_streamed_response_wrapper(
|
|
351
365
|
speech.transcribe,
|
|
@@ -5,11 +5,19 @@ from __future__ import annotations
|
|
|
5
5
|
import os
|
|
6
6
|
from typing import Any, cast
|
|
7
7
|
|
|
8
|
+
import httpx
|
|
8
9
|
import pytest
|
|
10
|
+
from respx import MockRouter
|
|
9
11
|
|
|
10
12
|
from spitch import Spitch, AsyncSpitch
|
|
11
13
|
from tests.utils import assert_matches_type
|
|
12
14
|
from spitch.types import SpeechTranscribeResponse
|
|
15
|
+
from spitch._response import (
|
|
16
|
+
BinaryAPIResponse,
|
|
17
|
+
AsyncBinaryAPIResponse,
|
|
18
|
+
StreamedBinaryAPIResponse,
|
|
19
|
+
AsyncStreamedBinaryAPIResponse,
|
|
20
|
+
)
|
|
13
21
|
|
|
14
22
|
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
|
|
15
23
|
|
|
@@ -18,51 +26,67 @@ class TestSpeech:
|
|
|
18
26
|
parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
|
|
19
27
|
|
|
20
28
|
@parametrize
|
|
21
|
-
|
|
29
|
+
@pytest.mark.respx(base_url=base_url)
|
|
30
|
+
def test_method_generate(self, client: Spitch, respx_mock: MockRouter) -> None:
|
|
31
|
+
respx_mock.post("/v1/speech").mock(return_value=httpx.Response(200, json={"foo": "bar"}))
|
|
22
32
|
speech = client.speech.generate(
|
|
23
33
|
language="yo",
|
|
24
34
|
text="text",
|
|
25
35
|
voice="sade",
|
|
26
36
|
)
|
|
27
|
-
|
|
37
|
+
assert speech.is_closed
|
|
38
|
+
assert speech.json() == {"foo": "bar"}
|
|
39
|
+
assert cast(Any, speech.is_closed) is True
|
|
40
|
+
assert isinstance(speech, BinaryAPIResponse)
|
|
28
41
|
|
|
29
42
|
@parametrize
|
|
30
|
-
|
|
43
|
+
@pytest.mark.respx(base_url=base_url)
|
|
44
|
+
def test_method_generate_with_all_params(self, client: Spitch, respx_mock: MockRouter) -> None:
|
|
45
|
+
respx_mock.post("/v1/speech").mock(return_value=httpx.Response(200, json={"foo": "bar"}))
|
|
31
46
|
speech = client.speech.generate(
|
|
32
47
|
language="yo",
|
|
33
48
|
text="text",
|
|
34
49
|
voice="sade",
|
|
35
50
|
model="legacy",
|
|
36
51
|
)
|
|
37
|
-
|
|
52
|
+
assert speech.is_closed
|
|
53
|
+
assert speech.json() == {"foo": "bar"}
|
|
54
|
+
assert cast(Any, speech.is_closed) is True
|
|
55
|
+
assert isinstance(speech, BinaryAPIResponse)
|
|
38
56
|
|
|
39
57
|
@parametrize
|
|
40
|
-
|
|
41
|
-
|
|
58
|
+
@pytest.mark.respx(base_url=base_url)
|
|
59
|
+
def test_raw_response_generate(self, client: Spitch, respx_mock: MockRouter) -> None:
|
|
60
|
+
respx_mock.post("/v1/speech").mock(return_value=httpx.Response(200, json={"foo": "bar"}))
|
|
61
|
+
|
|
62
|
+
speech = client.speech.with_raw_response.generate(
|
|
42
63
|
language="yo",
|
|
43
64
|
text="text",
|
|
44
65
|
voice="sade",
|
|
45
66
|
)
|
|
46
67
|
|
|
47
|
-
assert
|
|
48
|
-
assert
|
|
49
|
-
speech
|
|
50
|
-
|
|
68
|
+
assert speech.is_closed is True
|
|
69
|
+
assert speech.http_request.headers.get("X-Stainless-Lang") == "python"
|
|
70
|
+
assert speech.json() == {"foo": "bar"}
|
|
71
|
+
assert isinstance(speech, BinaryAPIResponse)
|
|
51
72
|
|
|
52
73
|
@parametrize
|
|
53
|
-
|
|
74
|
+
@pytest.mark.respx(base_url=base_url)
|
|
75
|
+
def test_streaming_response_generate(self, client: Spitch, respx_mock: MockRouter) -> None:
|
|
76
|
+
respx_mock.post("/v1/speech").mock(return_value=httpx.Response(200, json={"foo": "bar"}))
|
|
54
77
|
with client.speech.with_streaming_response.generate(
|
|
55
78
|
language="yo",
|
|
56
79
|
text="text",
|
|
57
80
|
voice="sade",
|
|
58
|
-
) as
|
|
59
|
-
assert not
|
|
60
|
-
assert
|
|
81
|
+
) as speech:
|
|
82
|
+
assert not speech.is_closed
|
|
83
|
+
assert speech.http_request.headers.get("X-Stainless-Lang") == "python"
|
|
61
84
|
|
|
62
|
-
speech
|
|
63
|
-
|
|
85
|
+
assert speech.json() == {"foo": "bar"}
|
|
86
|
+
assert cast(Any, speech.is_closed) is True
|
|
87
|
+
assert isinstance(speech, StreamedBinaryAPIResponse)
|
|
64
88
|
|
|
65
|
-
assert cast(Any,
|
|
89
|
+
assert cast(Any, speech.is_closed) is True
|
|
66
90
|
|
|
67
91
|
@parametrize
|
|
68
92
|
def test_method_transcribe(self, client: Spitch) -> None:
|
|
@@ -114,51 +138,67 @@ class TestAsyncSpeech:
|
|
|
114
138
|
)
|
|
115
139
|
|
|
116
140
|
@parametrize
|
|
117
|
-
|
|
141
|
+
@pytest.mark.respx(base_url=base_url)
|
|
142
|
+
async def test_method_generate(self, async_client: AsyncSpitch, respx_mock: MockRouter) -> None:
|
|
143
|
+
respx_mock.post("/v1/speech").mock(return_value=httpx.Response(200, json={"foo": "bar"}))
|
|
118
144
|
speech = await async_client.speech.generate(
|
|
119
145
|
language="yo",
|
|
120
146
|
text="text",
|
|
121
147
|
voice="sade",
|
|
122
148
|
)
|
|
123
|
-
|
|
149
|
+
assert speech.is_closed
|
|
150
|
+
assert await speech.json() == {"foo": "bar"}
|
|
151
|
+
assert cast(Any, speech.is_closed) is True
|
|
152
|
+
assert isinstance(speech, AsyncBinaryAPIResponse)
|
|
124
153
|
|
|
125
154
|
@parametrize
|
|
126
|
-
|
|
155
|
+
@pytest.mark.respx(base_url=base_url)
|
|
156
|
+
async def test_method_generate_with_all_params(self, async_client: AsyncSpitch, respx_mock: MockRouter) -> None:
|
|
157
|
+
respx_mock.post("/v1/speech").mock(return_value=httpx.Response(200, json={"foo": "bar"}))
|
|
127
158
|
speech = await async_client.speech.generate(
|
|
128
159
|
language="yo",
|
|
129
160
|
text="text",
|
|
130
161
|
voice="sade",
|
|
131
162
|
model="legacy",
|
|
132
163
|
)
|
|
133
|
-
|
|
164
|
+
assert speech.is_closed
|
|
165
|
+
assert await speech.json() == {"foo": "bar"}
|
|
166
|
+
assert cast(Any, speech.is_closed) is True
|
|
167
|
+
assert isinstance(speech, AsyncBinaryAPIResponse)
|
|
134
168
|
|
|
135
169
|
@parametrize
|
|
136
|
-
|
|
137
|
-
|
|
170
|
+
@pytest.mark.respx(base_url=base_url)
|
|
171
|
+
async def test_raw_response_generate(self, async_client: AsyncSpitch, respx_mock: MockRouter) -> None:
|
|
172
|
+
respx_mock.post("/v1/speech").mock(return_value=httpx.Response(200, json={"foo": "bar"}))
|
|
173
|
+
|
|
174
|
+
speech = await async_client.speech.with_raw_response.generate(
|
|
138
175
|
language="yo",
|
|
139
176
|
text="text",
|
|
140
177
|
voice="sade",
|
|
141
178
|
)
|
|
142
179
|
|
|
143
|
-
assert
|
|
144
|
-
assert
|
|
145
|
-
|
|
146
|
-
|
|
180
|
+
assert speech.is_closed is True
|
|
181
|
+
assert speech.http_request.headers.get("X-Stainless-Lang") == "python"
|
|
182
|
+
assert await speech.json() == {"foo": "bar"}
|
|
183
|
+
assert isinstance(speech, AsyncBinaryAPIResponse)
|
|
147
184
|
|
|
148
185
|
@parametrize
|
|
149
|
-
|
|
186
|
+
@pytest.mark.respx(base_url=base_url)
|
|
187
|
+
async def test_streaming_response_generate(self, async_client: AsyncSpitch, respx_mock: MockRouter) -> None:
|
|
188
|
+
respx_mock.post("/v1/speech").mock(return_value=httpx.Response(200, json={"foo": "bar"}))
|
|
150
189
|
async with async_client.speech.with_streaming_response.generate(
|
|
151
190
|
language="yo",
|
|
152
191
|
text="text",
|
|
153
192
|
voice="sade",
|
|
154
|
-
) as
|
|
155
|
-
assert not
|
|
156
|
-
assert
|
|
193
|
+
) as speech:
|
|
194
|
+
assert not speech.is_closed
|
|
195
|
+
assert speech.http_request.headers.get("X-Stainless-Lang") == "python"
|
|
157
196
|
|
|
158
|
-
|
|
159
|
-
|
|
197
|
+
assert await speech.json() == {"foo": "bar"}
|
|
198
|
+
assert cast(Any, speech.is_closed) is True
|
|
199
|
+
assert isinstance(speech, AsyncStreamedBinaryAPIResponse)
|
|
160
200
|
|
|
161
|
-
assert cast(Any,
|
|
201
|
+
assert cast(Any, speech.is_closed) is True
|
|
162
202
|
|
|
163
203
|
@parametrize
|
|
164
204
|
async def test_method_transcribe(self, async_client: AsyncSpitch) -> None:
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|