spitch 1.30.0__tar.gz → 1.32.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.

Files changed (76) hide show
  1. spitch-1.32.0/.release-please-manifest.json +3 -0
  2. {spitch-1.30.0 → spitch-1.32.0}/CHANGELOG.md +16 -0
  3. {spitch-1.30.0 → spitch-1.32.0}/PKG-INFO +1 -1
  4. {spitch-1.30.0 → spitch-1.32.0}/api.md +1 -1
  5. {spitch-1.30.0 → spitch-1.32.0}/pyproject.toml +1 -1
  6. {spitch-1.30.0 → spitch-1.32.0}/src/spitch/_version.py +1 -1
  7. {spitch-1.30.0 → spitch-1.32.0}/src/spitch/resources/speech.py +44 -46
  8. {spitch-1.30.0 → spitch-1.32.0}/tests/api_resources/test_speech.py +34 -74
  9. spitch-1.30.0/.release-please-manifest.json +0 -3
  10. {spitch-1.30.0 → spitch-1.32.0}/.gitignore +0 -0
  11. {spitch-1.30.0 → spitch-1.32.0}/CONTRIBUTING.md +0 -0
  12. {spitch-1.30.0 → spitch-1.32.0}/LICENSE +0 -0
  13. {spitch-1.30.0 → spitch-1.32.0}/README.md +0 -0
  14. {spitch-1.30.0 → spitch-1.32.0}/SECURITY.md +0 -0
  15. {spitch-1.30.0 → spitch-1.32.0}/bin/check-release-environment +0 -0
  16. {spitch-1.30.0 → spitch-1.32.0}/bin/publish-pypi +0 -0
  17. {spitch-1.30.0 → spitch-1.32.0}/examples/.keep +0 -0
  18. {spitch-1.30.0 → spitch-1.32.0}/examples/example.py +0 -0
  19. {spitch-1.30.0 → spitch-1.32.0}/mypy.ini +0 -0
  20. {spitch-1.30.0 → spitch-1.32.0}/noxfile.py +0 -0
  21. {spitch-1.30.0 → spitch-1.32.0}/release-please-config.json +0 -0
  22. {spitch-1.30.0 → spitch-1.32.0}/requirements-dev.lock +0 -0
  23. {spitch-1.30.0 → spitch-1.32.0}/requirements.lock +0 -0
  24. {spitch-1.30.0 → spitch-1.32.0}/src/spitch/__init__.py +0 -0
  25. {spitch-1.30.0 → spitch-1.32.0}/src/spitch/_base_client.py +0 -0
  26. {spitch-1.30.0 → spitch-1.32.0}/src/spitch/_client.py +0 -0
  27. {spitch-1.30.0 → spitch-1.32.0}/src/spitch/_compat.py +0 -0
  28. {spitch-1.30.0 → spitch-1.32.0}/src/spitch/_constants.py +0 -0
  29. {spitch-1.30.0 → spitch-1.32.0}/src/spitch/_exceptions.py +0 -0
  30. {spitch-1.30.0 → spitch-1.32.0}/src/spitch/_files.py +0 -0
  31. {spitch-1.30.0 → spitch-1.32.0}/src/spitch/_models.py +0 -0
  32. {spitch-1.30.0 → spitch-1.32.0}/src/spitch/_qs.py +0 -0
  33. {spitch-1.30.0 → spitch-1.32.0}/src/spitch/_resource.py +0 -0
  34. {spitch-1.30.0 → spitch-1.32.0}/src/spitch/_response.py +0 -0
  35. {spitch-1.30.0 → spitch-1.32.0}/src/spitch/_streaming.py +0 -0
  36. {spitch-1.30.0 → spitch-1.32.0}/src/spitch/_types.py +0 -0
  37. {spitch-1.30.0 → spitch-1.32.0}/src/spitch/_utils/__init__.py +0 -0
  38. {spitch-1.30.0 → spitch-1.32.0}/src/spitch/_utils/_logs.py +0 -0
  39. {spitch-1.30.0 → spitch-1.32.0}/src/spitch/_utils/_proxy.py +0 -0
  40. {spitch-1.30.0 → spitch-1.32.0}/src/spitch/_utils/_reflection.py +0 -0
  41. {spitch-1.30.0 → spitch-1.32.0}/src/spitch/_utils/_resources_proxy.py +0 -0
  42. {spitch-1.30.0 → spitch-1.32.0}/src/spitch/_utils/_streams.py +0 -0
  43. {spitch-1.30.0 → spitch-1.32.0}/src/spitch/_utils/_sync.py +0 -0
  44. {spitch-1.30.0 → spitch-1.32.0}/src/spitch/_utils/_transform.py +0 -0
  45. {spitch-1.30.0 → spitch-1.32.0}/src/spitch/_utils/_typing.py +0 -0
  46. {spitch-1.30.0 → spitch-1.32.0}/src/spitch/_utils/_utils.py +0 -0
  47. {spitch-1.30.0 → spitch-1.32.0}/src/spitch/lib/.keep +0 -0
  48. {spitch-1.30.0 → spitch-1.32.0}/src/spitch/py.typed +0 -0
  49. {spitch-1.30.0 → spitch-1.32.0}/src/spitch/resources/__init__.py +0 -0
  50. {spitch-1.30.0 → spitch-1.32.0}/src/spitch/resources/text.py +0 -0
  51. {spitch-1.30.0 → spitch-1.32.0}/src/spitch/types/__init__.py +0 -0
  52. {spitch-1.30.0 → spitch-1.32.0}/src/spitch/types/speech_generate_params.py +0 -0
  53. {spitch-1.30.0 → spitch-1.32.0}/src/spitch/types/speech_transcribe_params.py +0 -0
  54. {spitch-1.30.0 → spitch-1.32.0}/src/spitch/types/speech_transcribe_response.py +0 -0
  55. {spitch-1.30.0 → spitch-1.32.0}/src/spitch/types/text_tone_mark_params.py +0 -0
  56. {spitch-1.30.0 → spitch-1.32.0}/src/spitch/types/text_tone_mark_response.py +0 -0
  57. {spitch-1.30.0 → spitch-1.32.0}/src/spitch/types/text_translate_params.py +0 -0
  58. {spitch-1.30.0 → spitch-1.32.0}/src/spitch/types/text_translate_response.py +0 -0
  59. {spitch-1.30.0 → spitch-1.32.0}/tests/__init__.py +0 -0
  60. {spitch-1.30.0 → spitch-1.32.0}/tests/api_resources/__init__.py +0 -0
  61. {spitch-1.30.0 → spitch-1.32.0}/tests/api_resources/test_text.py +0 -0
  62. {spitch-1.30.0 → spitch-1.32.0}/tests/conftest.py +0 -0
  63. {spitch-1.30.0 → spitch-1.32.0}/tests/sample_file.txt +0 -0
  64. {spitch-1.30.0 → spitch-1.32.0}/tests/test_client.py +0 -0
  65. {spitch-1.30.0 → spitch-1.32.0}/tests/test_deepcopy.py +0 -0
  66. {spitch-1.30.0 → spitch-1.32.0}/tests/test_extract_files.py +0 -0
  67. {spitch-1.30.0 → spitch-1.32.0}/tests/test_files.py +0 -0
  68. {spitch-1.30.0 → spitch-1.32.0}/tests/test_models.py +0 -0
  69. {spitch-1.30.0 → spitch-1.32.0}/tests/test_qs.py +0 -0
  70. {spitch-1.30.0 → spitch-1.32.0}/tests/test_required_args.py +0 -0
  71. {spitch-1.30.0 → spitch-1.32.0}/tests/test_response.py +0 -0
  72. {spitch-1.30.0 → spitch-1.32.0}/tests/test_streaming.py +0 -0
  73. {spitch-1.30.0 → spitch-1.32.0}/tests/test_transform.py +0 -0
  74. {spitch-1.30.0 → spitch-1.32.0}/tests/test_utils/test_proxy.py +0 -0
  75. {spitch-1.30.0 → spitch-1.32.0}/tests/test_utils/test_typing.py +0 -0
  76. {spitch-1.30.0 → spitch-1.32.0}/tests/utils.py +0 -0
@@ -0,0 +1,3 @@
1
+ {
2
+ ".": "1.32.0"
3
+ }
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.32.0 (2025-08-02)
4
+
5
+ Full Changelog: [v1.31.0...v1.32.0](https://github.com/spi-tch/spitch-python/compare/v1.31.0...v1.32.0)
6
+
7
+ ### Features
8
+
9
+ * **api:** update via SDK Studio ([49e48bf](https://github.com/spi-tch/spitch-python/commit/49e48bf33fc79945d5828b3524ecaa49a0186d6e))
10
+
11
+ ## 1.31.0 (2025-08-02)
12
+
13
+ Full Changelog: [v1.30.0...v1.31.0](https://github.com/spi-tch/spitch-python/compare/v1.30.0...v1.31.0)
14
+
15
+ ### Features
16
+
17
+ * **api:** update via SDK Studio ([cbe2e04](https://github.com/spi-tch/spitch-python/commit/cbe2e040af49ed35c984afc10c1484d35a9e0582))
18
+
3
19
  ## 1.30.0 (2025-08-02)
4
20
 
5
21
  Full Changelog: [v1.29.0...v1.30.0](https://github.com/spi-tch/spitch-python/compare/v1.29.0...v1.30.0)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: spitch
3
- Version: 1.30.0
3
+ Version: 1.32.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
@@ -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>) -> BinaryAPIResponse</code>
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>) -> object</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
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "spitch"
3
- version = "1.30.0"
3
+ version = "1.32.0"
4
4
  description = "The official Python library for the spitch API"
5
5
  dynamic = ["readme"]
6
6
  license = "Apache-2.0"
@@ -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.30.0" # x-release-please-version
4
+ __version__ = "1.32.0" # x-release-please-version
@@ -2,29 +2,21 @@
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
9
9
 
10
10
  from ..types import speech_generate_params, speech_transcribe_params
11
11
  from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven, FileTypes
12
- from .._utils import maybe_transform, async_maybe_transform
12
+ from .._utils import extract_files, maybe_transform, deepcopy_minimal, async_maybe_transform
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,
20
16
  to_raw_response_wrapper,
21
17
  to_streamed_response_wrapper,
22
18
  async_to_raw_response_wrapper,
23
- to_custom_raw_response_wrapper,
24
19
  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,
28
20
  )
29
21
  from .._base_client import make_request_options
30
22
  from ..types.speech_transcribe_response import SpeechTranscribeResponse
@@ -88,7 +80,7 @@ class SpeechResource(SyncAPIResource):
88
80
  extra_query: Query | None = None,
89
81
  extra_body: Body | None = None,
90
82
  timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
91
- ) -> BinaryAPIResponse:
83
+ ) -> object:
92
84
  """
93
85
  Synthesize
94
86
 
@@ -101,7 +93,6 @@ class SpeechResource(SyncAPIResource):
101
93
 
102
94
  timeout: Override the client-level default timeout for this request, in seconds
103
95
  """
104
- extra_headers = {"Accept": "audio/wav", **(extra_headers or {})}
105
96
  return self._post(
106
97
  "/v1/speech",
107
98
  body=maybe_transform(
@@ -116,7 +107,7 @@ class SpeechResource(SyncAPIResource):
116
107
  options=make_request_options(
117
108
  extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
118
109
  ),
119
- cast_to=BinaryAPIResponse,
110
+ cast_to=object,
120
111
  )
121
112
 
122
113
  def transcribe(
@@ -147,19 +138,25 @@ class SpeechResource(SyncAPIResource):
147
138
 
148
139
  timeout: Override the client-level default timeout for this request, in seconds
149
140
  """
141
+ body = deepcopy_minimal(
142
+ {
143
+ "language": language,
144
+ "content": content,
145
+ "model": model,
146
+ "special_words": special_words,
147
+ "timestamp": timestamp,
148
+ "url": url,
149
+ }
150
+ )
151
+ files = extract_files(cast(Mapping[str, object], body), paths=[["content"]])
152
+ # It should be noted that the actual Content-Type header that will be
153
+ # sent to the server will contain a `boundary` parameter, e.g.
154
+ # multipart/form-data; boundary=---abc--
155
+ extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}
150
156
  return self._post(
151
157
  "/v1/transcriptions",
152
- body=maybe_transform(
153
- {
154
- "language": language,
155
- "content": content,
156
- "model": model,
157
- "special_words": special_words,
158
- "timestamp": timestamp,
159
- "url": url,
160
- },
161
- speech_transcribe_params.SpeechTranscribeParams,
162
- ),
158
+ body=maybe_transform(body, speech_transcribe_params.SpeechTranscribeParams),
159
+ files=files,
163
160
  options=make_request_options(
164
161
  extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
165
162
  ),
@@ -223,7 +220,7 @@ class AsyncSpeechResource(AsyncAPIResource):
223
220
  extra_query: Query | None = None,
224
221
  extra_body: Body | None = None,
225
222
  timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
226
- ) -> AsyncBinaryAPIResponse:
223
+ ) -> object:
227
224
  """
228
225
  Synthesize
229
226
 
@@ -236,7 +233,6 @@ class AsyncSpeechResource(AsyncAPIResource):
236
233
 
237
234
  timeout: Override the client-level default timeout for this request, in seconds
238
235
  """
239
- extra_headers = {"Accept": "audio/wav", **(extra_headers or {})}
240
236
  return await self._post(
241
237
  "/v1/speech",
242
238
  body=await async_maybe_transform(
@@ -251,7 +247,7 @@ class AsyncSpeechResource(AsyncAPIResource):
251
247
  options=make_request_options(
252
248
  extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
253
249
  ),
254
- cast_to=AsyncBinaryAPIResponse,
250
+ cast_to=object,
255
251
  )
256
252
 
257
253
  async def transcribe(
@@ -282,19 +278,25 @@ class AsyncSpeechResource(AsyncAPIResource):
282
278
 
283
279
  timeout: Override the client-level default timeout for this request, in seconds
284
280
  """
281
+ body = deepcopy_minimal(
282
+ {
283
+ "language": language,
284
+ "content": content,
285
+ "model": model,
286
+ "special_words": special_words,
287
+ "timestamp": timestamp,
288
+ "url": url,
289
+ }
290
+ )
291
+ files = extract_files(cast(Mapping[str, object], body), paths=[["content"]])
292
+ # It should be noted that the actual Content-Type header that will be
293
+ # sent to the server will contain a `boundary` parameter, e.g.
294
+ # multipart/form-data; boundary=---abc--
295
+ extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}
285
296
  return await self._post(
286
297
  "/v1/transcriptions",
287
- body=await async_maybe_transform(
288
- {
289
- "language": language,
290
- "content": content,
291
- "model": model,
292
- "special_words": special_words,
293
- "timestamp": timestamp,
294
- "url": url,
295
- },
296
- speech_transcribe_params.SpeechTranscribeParams,
297
- ),
298
+ body=await async_maybe_transform(body, speech_transcribe_params.SpeechTranscribeParams),
299
+ files=files,
298
300
  options=make_request_options(
299
301
  extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
300
302
  ),
@@ -306,9 +308,8 @@ class SpeechResourceWithRawResponse:
306
308
  def __init__(self, speech: SpeechResource) -> None:
307
309
  self._speech = speech
308
310
 
309
- self.generate = to_custom_raw_response_wrapper(
311
+ self.generate = to_raw_response_wrapper(
310
312
  speech.generate,
311
- BinaryAPIResponse,
312
313
  )
313
314
  self.transcribe = to_raw_response_wrapper(
314
315
  speech.transcribe,
@@ -319,9 +320,8 @@ class AsyncSpeechResourceWithRawResponse:
319
320
  def __init__(self, speech: AsyncSpeechResource) -> None:
320
321
  self._speech = speech
321
322
 
322
- self.generate = async_to_custom_raw_response_wrapper(
323
+ self.generate = async_to_raw_response_wrapper(
323
324
  speech.generate,
324
- AsyncBinaryAPIResponse,
325
325
  )
326
326
  self.transcribe = async_to_raw_response_wrapper(
327
327
  speech.transcribe,
@@ -332,9 +332,8 @@ class SpeechResourceWithStreamingResponse:
332
332
  def __init__(self, speech: SpeechResource) -> None:
333
333
  self._speech = speech
334
334
 
335
- self.generate = to_custom_streamed_response_wrapper(
335
+ self.generate = to_streamed_response_wrapper(
336
336
  speech.generate,
337
- StreamedBinaryAPIResponse,
338
337
  )
339
338
  self.transcribe = to_streamed_response_wrapper(
340
339
  speech.transcribe,
@@ -345,9 +344,8 @@ class AsyncSpeechResourceWithStreamingResponse:
345
344
  def __init__(self, speech: AsyncSpeechResource) -> None:
346
345
  self._speech = speech
347
346
 
348
- self.generate = async_to_custom_streamed_response_wrapper(
347
+ self.generate = async_to_streamed_response_wrapper(
349
348
  speech.generate,
350
- AsyncStreamedBinaryAPIResponse,
351
349
  )
352
350
  self.transcribe = async_to_streamed_response_wrapper(
353
351
  speech.transcribe,
@@ -5,19 +5,11 @@ from __future__ import annotations
5
5
  import os
6
6
  from typing import Any, cast
7
7
 
8
- import httpx
9
8
  import pytest
10
- from respx import MockRouter
11
9
 
12
10
  from spitch import Spitch, AsyncSpitch
13
11
  from tests.utils import assert_matches_type
14
12
  from spitch.types import SpeechTranscribeResponse
15
- from spitch._response import (
16
- BinaryAPIResponse,
17
- AsyncBinaryAPIResponse,
18
- StreamedBinaryAPIResponse,
19
- AsyncStreamedBinaryAPIResponse,
20
- )
21
13
 
22
14
  base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
23
15
 
@@ -26,67 +18,51 @@ class TestSpeech:
26
18
  parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
27
19
 
28
20
  @parametrize
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"}))
21
+ def test_method_generate(self, client: Spitch) -> None:
32
22
  speech = client.speech.generate(
33
23
  language="yo",
34
24
  text="text",
35
25
  voice="sade",
36
26
  )
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)
27
+ assert_matches_type(object, speech, path=["response"])
41
28
 
42
29
  @parametrize
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"}))
30
+ def test_method_generate_with_all_params(self, client: Spitch) -> None:
46
31
  speech = client.speech.generate(
47
32
  language="yo",
48
33
  text="text",
49
34
  voice="sade",
50
35
  model="legacy",
51
36
  )
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)
37
+ assert_matches_type(object, speech, path=["response"])
56
38
 
57
39
  @parametrize
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(
40
+ def test_raw_response_generate(self, client: Spitch) -> None:
41
+ response = client.speech.with_raw_response.generate(
63
42
  language="yo",
64
43
  text="text",
65
44
  voice="sade",
66
45
  )
67
46
 
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)
47
+ assert response.is_closed is True
48
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
49
+ speech = response.parse()
50
+ assert_matches_type(object, speech, path=["response"])
72
51
 
73
52
  @parametrize
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"}))
53
+ def test_streaming_response_generate(self, client: Spitch) -> None:
77
54
  with client.speech.with_streaming_response.generate(
78
55
  language="yo",
79
56
  text="text",
80
57
  voice="sade",
81
- ) as speech:
82
- assert not speech.is_closed
83
- assert speech.http_request.headers.get("X-Stainless-Lang") == "python"
58
+ ) as response:
59
+ assert not response.is_closed
60
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
84
61
 
85
- assert speech.json() == {"foo": "bar"}
86
- assert cast(Any, speech.is_closed) is True
87
- assert isinstance(speech, StreamedBinaryAPIResponse)
62
+ speech = response.parse()
63
+ assert_matches_type(object, speech, path=["response"])
88
64
 
89
- assert cast(Any, speech.is_closed) is True
65
+ assert cast(Any, response.is_closed) is True
90
66
 
91
67
  @parametrize
92
68
  def test_method_transcribe(self, client: Spitch) -> None:
@@ -138,67 +114,51 @@ class TestAsyncSpeech:
138
114
  )
139
115
 
140
116
  @parametrize
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"}))
117
+ async def test_method_generate(self, async_client: AsyncSpitch) -> None:
144
118
  speech = await async_client.speech.generate(
145
119
  language="yo",
146
120
  text="text",
147
121
  voice="sade",
148
122
  )
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)
123
+ assert_matches_type(object, speech, path=["response"])
153
124
 
154
125
  @parametrize
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"}))
126
+ async def test_method_generate_with_all_params(self, async_client: AsyncSpitch) -> None:
158
127
  speech = await async_client.speech.generate(
159
128
  language="yo",
160
129
  text="text",
161
130
  voice="sade",
162
131
  model="legacy",
163
132
  )
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)
133
+ assert_matches_type(object, speech, path=["response"])
168
134
 
169
135
  @parametrize
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(
136
+ async def test_raw_response_generate(self, async_client: AsyncSpitch) -> None:
137
+ response = await async_client.speech.with_raw_response.generate(
175
138
  language="yo",
176
139
  text="text",
177
140
  voice="sade",
178
141
  )
179
142
 
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)
143
+ assert response.is_closed is True
144
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
145
+ speech = await response.parse()
146
+ assert_matches_type(object, speech, path=["response"])
184
147
 
185
148
  @parametrize
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"}))
149
+ async def test_streaming_response_generate(self, async_client: AsyncSpitch) -> None:
189
150
  async with async_client.speech.with_streaming_response.generate(
190
151
  language="yo",
191
152
  text="text",
192
153
  voice="sade",
193
- ) as speech:
194
- assert not speech.is_closed
195
- assert speech.http_request.headers.get("X-Stainless-Lang") == "python"
154
+ ) as response:
155
+ assert not response.is_closed
156
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
196
157
 
197
- assert await speech.json() == {"foo": "bar"}
198
- assert cast(Any, speech.is_closed) is True
199
- assert isinstance(speech, AsyncStreamedBinaryAPIResponse)
158
+ speech = await response.parse()
159
+ assert_matches_type(object, speech, path=["response"])
200
160
 
201
- assert cast(Any, speech.is_closed) is True
161
+ assert cast(Any, response.is_closed) is True
202
162
 
203
163
  @parametrize
204
164
  async def test_method_transcribe(self, async_client: AsyncSpitch) -> None:
@@ -1,3 +0,0 @@
1
- {
2
- ".": "1.30.0"
3
- }
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