spitch 1.9.0__tar.gz → 1.11.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 (73) hide show
  1. spitch-1.11.0/.release-please-manifest.json +3 -0
  2. {spitch-1.9.0 → spitch-1.11.0}/CHANGELOG.md +16 -0
  3. {spitch-1.9.0 → spitch-1.11.0}/PKG-INFO +1 -1
  4. {spitch-1.9.0 → spitch-1.11.0}/api.md +2 -2
  5. {spitch-1.9.0 → spitch-1.11.0}/pyproject.toml +1 -1
  6. {spitch-1.9.0 → spitch-1.11.0}/src/spitch/_version.py +1 -1
  7. {spitch-1.9.0 → spitch-1.11.0}/src/spitch/resources/speech.py +28 -8
  8. {spitch-1.9.0 → spitch-1.11.0}/src/spitch/types/speech_transcribe_params.py +4 -0
  9. {spitch-1.9.0 → spitch-1.11.0}/tests/api_resources/test_speech.py +78 -34
  10. spitch-1.9.0/.release-please-manifest.json +0 -3
  11. {spitch-1.9.0 → spitch-1.11.0}/.gitignore +0 -0
  12. {spitch-1.9.0 → spitch-1.11.0}/CONTRIBUTING.md +0 -0
  13. {spitch-1.9.0 → spitch-1.11.0}/LICENSE +0 -0
  14. {spitch-1.9.0 → spitch-1.11.0}/README.md +0 -0
  15. {spitch-1.9.0 → spitch-1.11.0}/SECURITY.md +0 -0
  16. {spitch-1.9.0 → spitch-1.11.0}/bin/check-release-environment +0 -0
  17. {spitch-1.9.0 → spitch-1.11.0}/bin/publish-pypi +0 -0
  18. {spitch-1.9.0 → spitch-1.11.0}/examples/.keep +0 -0
  19. {spitch-1.9.0 → spitch-1.11.0}/examples/example.py +0 -0
  20. {spitch-1.9.0 → spitch-1.11.0}/mypy.ini +0 -0
  21. {spitch-1.9.0 → spitch-1.11.0}/noxfile.py +0 -0
  22. {spitch-1.9.0 → spitch-1.11.0}/release-please-config.json +0 -0
  23. {spitch-1.9.0 → spitch-1.11.0}/requirements-dev.lock +0 -0
  24. {spitch-1.9.0 → spitch-1.11.0}/requirements.lock +0 -0
  25. {spitch-1.9.0 → spitch-1.11.0}/src/spitch/__init__.py +0 -0
  26. {spitch-1.9.0 → spitch-1.11.0}/src/spitch/_base_client.py +0 -0
  27. {spitch-1.9.0 → spitch-1.11.0}/src/spitch/_client.py +0 -0
  28. {spitch-1.9.0 → spitch-1.11.0}/src/spitch/_compat.py +0 -0
  29. {spitch-1.9.0 → spitch-1.11.0}/src/spitch/_constants.py +0 -0
  30. {spitch-1.9.0 → spitch-1.11.0}/src/spitch/_exceptions.py +0 -0
  31. {spitch-1.9.0 → spitch-1.11.0}/src/spitch/_files.py +0 -0
  32. {spitch-1.9.0 → spitch-1.11.0}/src/spitch/_models.py +0 -0
  33. {spitch-1.9.0 → spitch-1.11.0}/src/spitch/_qs.py +0 -0
  34. {spitch-1.9.0 → spitch-1.11.0}/src/spitch/_resource.py +0 -0
  35. {spitch-1.9.0 → spitch-1.11.0}/src/spitch/_response.py +0 -0
  36. {spitch-1.9.0 → spitch-1.11.0}/src/spitch/_streaming.py +0 -0
  37. {spitch-1.9.0 → spitch-1.11.0}/src/spitch/_types.py +0 -0
  38. {spitch-1.9.0 → spitch-1.11.0}/src/spitch/_utils/__init__.py +0 -0
  39. {spitch-1.9.0 → spitch-1.11.0}/src/spitch/_utils/_logs.py +0 -0
  40. {spitch-1.9.0 → spitch-1.11.0}/src/spitch/_utils/_proxy.py +0 -0
  41. {spitch-1.9.0 → spitch-1.11.0}/src/spitch/_utils/_reflection.py +0 -0
  42. {spitch-1.9.0 → spitch-1.11.0}/src/spitch/_utils/_streams.py +0 -0
  43. {spitch-1.9.0 → spitch-1.11.0}/src/spitch/_utils/_sync.py +0 -0
  44. {spitch-1.9.0 → spitch-1.11.0}/src/spitch/_utils/_transform.py +0 -0
  45. {spitch-1.9.0 → spitch-1.11.0}/src/spitch/_utils/_typing.py +0 -0
  46. {spitch-1.9.0 → spitch-1.11.0}/src/spitch/_utils/_utils.py +0 -0
  47. {spitch-1.9.0 → spitch-1.11.0}/src/spitch/lib/.keep +0 -0
  48. {spitch-1.9.0 → spitch-1.11.0}/src/spitch/py.typed +0 -0
  49. {spitch-1.9.0 → spitch-1.11.0}/src/spitch/resources/__init__.py +0 -0
  50. {spitch-1.9.0 → spitch-1.11.0}/src/spitch/resources/text.py +0 -0
  51. {spitch-1.9.0 → spitch-1.11.0}/src/spitch/types/__init__.py +0 -0
  52. {spitch-1.9.0 → spitch-1.11.0}/src/spitch/types/speech_generate_params.py +0 -0
  53. {spitch-1.9.0 → spitch-1.11.0}/src/spitch/types/speech_transcibe_params.py +0 -0
  54. {spitch-1.9.0 → spitch-1.11.0}/src/spitch/types/text_tone_mark_params.py +0 -0
  55. {spitch-1.9.0 → spitch-1.11.0}/src/spitch/types/text_translate_params.py +0 -0
  56. {spitch-1.9.0 → spitch-1.11.0}/tests/__init__.py +0 -0
  57. {spitch-1.9.0 → spitch-1.11.0}/tests/api_resources/__init__.py +0 -0
  58. {spitch-1.9.0 → spitch-1.11.0}/tests/api_resources/test_text.py +0 -0
  59. {spitch-1.9.0 → spitch-1.11.0}/tests/conftest.py +0 -0
  60. {spitch-1.9.0 → spitch-1.11.0}/tests/sample_file.txt +0 -0
  61. {spitch-1.9.0 → spitch-1.11.0}/tests/test_client.py +0 -0
  62. {spitch-1.9.0 → spitch-1.11.0}/tests/test_deepcopy.py +0 -0
  63. {spitch-1.9.0 → spitch-1.11.0}/tests/test_extract_files.py +0 -0
  64. {spitch-1.9.0 → spitch-1.11.0}/tests/test_files.py +0 -0
  65. {spitch-1.9.0 → spitch-1.11.0}/tests/test_models.py +0 -0
  66. {spitch-1.9.0 → spitch-1.11.0}/tests/test_qs.py +0 -0
  67. {spitch-1.9.0 → spitch-1.11.0}/tests/test_required_args.py +0 -0
  68. {spitch-1.9.0 → spitch-1.11.0}/tests/test_response.py +0 -0
  69. {spitch-1.9.0 → spitch-1.11.0}/tests/test_streaming.py +0 -0
  70. {spitch-1.9.0 → spitch-1.11.0}/tests/test_transform.py +0 -0
  71. {spitch-1.9.0 → spitch-1.11.0}/tests/test_utils/test_proxy.py +0 -0
  72. {spitch-1.9.0 → spitch-1.11.0}/tests/test_utils/test_typing.py +0 -0
  73. {spitch-1.9.0 → spitch-1.11.0}/tests/utils.py +0 -0
@@ -0,0 +1,3 @@
1
+ {
2
+ ".": "1.11.0"
3
+ }
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.11.0 (2024-10-17)
4
+
5
+ Full Changelog: [v1.10.0...v1.11.0](https://github.com/spi-tch/spitch-python/compare/v1.10.0...v1.11.0)
6
+
7
+ ### Features
8
+
9
+ * **api:** api update ([#49](https://github.com/spi-tch/spitch-python/issues/49)) ([f4099b6](https://github.com/spi-tch/spitch-python/commit/f4099b6db02bcc4951d0ced67f7729a04cfa4e92))
10
+
11
+ ## 1.10.0 (2024-10-17)
12
+
13
+ Full Changelog: [v1.9.0...v1.10.0](https://github.com/spi-tch/spitch-python/compare/v1.9.0...v1.10.0)
14
+
15
+ ### Features
16
+
17
+ * **api:** api update ([#45](https://github.com/spi-tch/spitch-python/issues/45)) ([feb59bc](https://github.com/spi-tch/spitch-python/commit/feb59bc1cca800efff147800d51ff8bbf486e38b))
18
+
3
19
  ## 1.9.0 (2024-10-17)
4
20
 
5
21
  Full Changelog: [v1.8.0...v1.9.0](https://github.com/spi-tch/spitch-python/compare/v1.8.0...v1.9.0)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: spitch
3
- Version: 1.9.0
3
+ Version: 1.11.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
@@ -3,12 +3,12 @@
3
3
  Types:
4
4
 
5
5
  ```python
6
- from spitch.types import SpeechGenerateResponse, SpeechTranscribeResponse
6
+ from spitch.types import SpeechTranscribeResponse
7
7
  ```
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>) -> <a href="./src/spitch/types/speech_generate_response.py">object</a></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>) -> 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">object</a></code>
13
13
 
14
14
  # Text
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "spitch"
3
- version = "1.9.0"
3
+ version = "1.11.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.9.0" # x-release-please-version
4
+ __version__ = "1.11.0" # x-release-please-version
@@ -18,10 +18,18 @@ from .._utils import (
18
18
  from .._compat import cached_property
19
19
  from .._resource import SyncAPIResource, AsyncAPIResource
20
20
  from .._response import (
21
+ BinaryAPIResponse,
22
+ AsyncBinaryAPIResponse,
23
+ StreamedBinaryAPIResponse,
24
+ AsyncStreamedBinaryAPIResponse,
21
25
  to_raw_response_wrapper,
22
26
  to_streamed_response_wrapper,
23
27
  async_to_raw_response_wrapper,
28
+ to_custom_raw_response_wrapper,
24
29
  async_to_streamed_response_wrapper,
30
+ to_custom_streamed_response_wrapper,
31
+ async_to_custom_raw_response_wrapper,
32
+ async_to_custom_streamed_response_wrapper,
25
33
  )
26
34
  from .._base_client import make_request_options
27
35
 
@@ -61,7 +69,7 @@ class SpeechResource(SyncAPIResource):
61
69
  extra_query: Query | None = None,
62
70
  extra_body: Body | None = None,
63
71
  timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
64
- ) -> object:
72
+ ) -> BinaryAPIResponse:
65
73
  """
66
74
  Synthesize
67
75
 
@@ -74,6 +82,7 @@ class SpeechResource(SyncAPIResource):
74
82
 
75
83
  timeout: Override the client-level default timeout for this request, in seconds
76
84
  """
85
+ extra_headers = {"Accept": "audio/wav", **(extra_headers or {})}
77
86
  return self._post(
78
87
  "/v1/speech",
79
88
  body=maybe_transform(
@@ -91,7 +100,7 @@ class SpeechResource(SyncAPIResource):
91
100
  timeout=timeout,
92
101
  query=maybe_transform({"stream": stream}, speech_generate_params.SpeechGenerateParams),
93
102
  ),
94
- cast_to=object,
103
+ cast_to=BinaryAPIResponse,
95
104
  )
96
105
 
97
106
  def transcribe(
@@ -99,6 +108,8 @@ class SpeechResource(SyncAPIResource):
99
108
  *,
100
109
  language: Literal["yo", "en", "ha", "ig"],
101
110
  content: Optional[FileTypes] | NotGiven = NOT_GIVEN,
111
+ multispeaker: Optional[bool] | NotGiven = NOT_GIVEN,
112
+ timestamp: Optional[bool] | NotGiven = NOT_GIVEN,
102
113
  url: Optional[str] | NotGiven = NOT_GIVEN,
103
114
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
104
115
  # The extra values given here take precedence over values defined on the client or passed to this method.
@@ -123,6 +134,8 @@ class SpeechResource(SyncAPIResource):
123
134
  {
124
135
  "language": language,
125
136
  "content": content,
137
+ "multispeaker": multispeaker,
138
+ "timestamp": timestamp,
126
139
  "url": url,
127
140
  }
128
141
  )
@@ -175,7 +188,7 @@ class AsyncSpeechResource(AsyncAPIResource):
175
188
  extra_query: Query | None = None,
176
189
  extra_body: Body | None = None,
177
190
  timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
178
- ) -> object:
191
+ ) -> AsyncBinaryAPIResponse:
179
192
  """
180
193
  Synthesize
181
194
 
@@ -188,6 +201,7 @@ class AsyncSpeechResource(AsyncAPIResource):
188
201
 
189
202
  timeout: Override the client-level default timeout for this request, in seconds
190
203
  """
204
+ extra_headers = {"Accept": "audio/wav", **(extra_headers or {})}
191
205
  return await self._post(
192
206
  "/v1/speech",
193
207
  body=await async_maybe_transform(
@@ -205,7 +219,7 @@ class AsyncSpeechResource(AsyncAPIResource):
205
219
  timeout=timeout,
206
220
  query=await async_maybe_transform({"stream": stream}, speech_generate_params.SpeechGenerateParams),
207
221
  ),
208
- cast_to=object,
222
+ cast_to=AsyncBinaryAPIResponse,
209
223
  )
210
224
 
211
225
  async def transcribe(
@@ -213,6 +227,8 @@ class AsyncSpeechResource(AsyncAPIResource):
213
227
  *,
214
228
  language: Literal["yo", "en", "ha", "ig"],
215
229
  content: Optional[FileTypes] | NotGiven = NOT_GIVEN,
230
+ multispeaker: Optional[bool] | NotGiven = NOT_GIVEN,
231
+ timestamp: Optional[bool] | NotGiven = NOT_GIVEN,
216
232
  url: Optional[str] | NotGiven = NOT_GIVEN,
217
233
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
218
234
  # The extra values given here take precedence over values defined on the client or passed to this method.
@@ -237,6 +253,8 @@ class AsyncSpeechResource(AsyncAPIResource):
237
253
  {
238
254
  "language": language,
239
255
  "content": content,
256
+ "multispeaker": multispeaker,
257
+ "timestamp": timestamp,
240
258
  "url": url,
241
259
  }
242
260
  )
@@ -260,8 +278,9 @@ class SpeechResourceWithRawResponse:
260
278
  def __init__(self, speech: SpeechResource) -> None:
261
279
  self._speech = speech
262
280
 
263
- self.generate = to_raw_response_wrapper(
281
+ self.generate = to_custom_raw_response_wrapper(
264
282
  speech.generate,
283
+ BinaryAPIResponse,
265
284
  )
266
285
  self.transcribe = to_raw_response_wrapper(
267
286
  speech.transcribe,
@@ -272,8 +291,9 @@ class AsyncSpeechResourceWithRawResponse:
272
291
  def __init__(self, speech: AsyncSpeechResource) -> None:
273
292
  self._speech = speech
274
293
 
275
- self.generate = async_to_raw_response_wrapper(
294
+ self.generate = async_to_custom_raw_response_wrapper(
276
295
  speech.generate,
296
+ AsyncBinaryAPIResponse,
277
297
  )
278
298
  self.transcribe = async_to_raw_response_wrapper(
279
299
  speech.transcribe,
@@ -284,7 +304,7 @@ class SpeechResourceWithStreamingResponse:
284
304
  def __init__(self, speech: SpeechResource) -> None:
285
305
  self._speech = speech
286
306
 
287
- self.generate = to_streamed_response_wrapper(
307
+ self.generate = to_custom_streamed_response_wrapper(
288
308
  speech.generate,
289
309
  StreamedBinaryAPIResponse
290
310
  )
@@ -297,7 +317,7 @@ class AsyncSpeechResourceWithStreamingResponse:
297
317
  def __init__(self, speech: AsyncSpeechResource) -> None:
298
318
  self._speech = speech
299
319
 
300
- self.generate = async_to_streamed_response_wrapper(
320
+ self.generate = async_to_custom_streamed_response_wrapper(
301
321
  speech.generate,
302
322
  AsyncStreamedBinaryAPIResponse
303
323
  )
@@ -15,4 +15,8 @@ class SpeechTranscribeParams(TypedDict, total=False):
15
15
 
16
16
  content: Optional[FileTypes]
17
17
 
18
+ multispeaker: Optional[bool]
19
+
20
+ timestamp: Optional[bool]
21
+
18
22
  url: Optional[str]
@@ -5,10 +5,18 @@ 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
14
+ from spitch._response import (
15
+ BinaryAPIResponse,
16
+ AsyncBinaryAPIResponse,
17
+ StreamedBinaryAPIResponse,
18
+ AsyncStreamedBinaryAPIResponse,
19
+ )
12
20
 
13
21
  base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
14
22
 
@@ -17,48 +25,64 @@ class TestSpeech:
17
25
  parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
18
26
 
19
27
  @parametrize
20
- def test_method_generate(self, client: Spitch) -> None:
28
+ @pytest.mark.respx(base_url=base_url)
29
+ def test_method_generate(self, client: Spitch, respx_mock: MockRouter) -> None:
30
+ respx_mock.post("/v1/speech").mock(return_value=httpx.Response(200, json={"foo": "bar"}))
21
31
  speech = client.speech.generate(
22
32
  language="yo",
23
33
  text="text",
24
34
  )
25
- assert_matches_type(object, speech, path=["response"])
35
+ assert speech.is_closed
36
+ assert speech.json() == {"foo": "bar"}
37
+ assert cast(Any, speech.is_closed) is True
38
+ assert isinstance(speech, BinaryAPIResponse)
26
39
 
27
40
  @parametrize
28
- def test_method_generate_with_all_params(self, client: Spitch) -> None:
41
+ @pytest.mark.respx(base_url=base_url)
42
+ def test_method_generate_with_all_params(self, client: Spitch, respx_mock: MockRouter) -> None:
43
+ respx_mock.post("/v1/speech").mock(return_value=httpx.Response(200, json={"foo": "bar"}))
29
44
  speech = client.speech.generate(
30
45
  language="yo",
31
46
  text="text",
32
47
  stream=True,
33
48
  voice="sade",
34
49
  )
35
- assert_matches_type(object, speech, path=["response"])
50
+ assert speech.is_closed
51
+ assert speech.json() == {"foo": "bar"}
52
+ assert cast(Any, speech.is_closed) is True
53
+ assert isinstance(speech, BinaryAPIResponse)
36
54
 
37
55
  @parametrize
38
- def test_raw_response_generate(self, client: Spitch) -> None:
39
- response = client.speech.with_raw_response.generate(
56
+ @pytest.mark.respx(base_url=base_url)
57
+ def test_raw_response_generate(self, client: Spitch, respx_mock: MockRouter) -> None:
58
+ respx_mock.post("/v1/speech").mock(return_value=httpx.Response(200, json={"foo": "bar"}))
59
+
60
+ speech = client.speech.with_raw_response.generate(
40
61
  language="yo",
41
62
  text="text",
42
63
  )
43
64
 
44
- assert response.is_closed is True
45
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
46
- speech = response.parse()
47
- assert_matches_type(object, speech, path=["response"])
65
+ assert speech.is_closed is True
66
+ assert speech.http_request.headers.get("X-Stainless-Lang") == "python"
67
+ assert speech.json() == {"foo": "bar"}
68
+ assert isinstance(speech, BinaryAPIResponse)
48
69
 
49
70
  @parametrize
50
- def test_streaming_response_generate(self, client: Spitch) -> None:
71
+ @pytest.mark.respx(base_url=base_url)
72
+ def test_streaming_response_generate(self, client: Spitch, respx_mock: MockRouter) -> None:
73
+ respx_mock.post("/v1/speech").mock(return_value=httpx.Response(200, json={"foo": "bar"}))
51
74
  with client.speech.with_streaming_response.generate(
52
75
  language="yo",
53
76
  text="text",
54
- ) as response:
55
- assert not response.is_closed
56
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
77
+ ) as speech:
78
+ assert not speech.is_closed
79
+ assert speech.http_request.headers.get("X-Stainless-Lang") == "python"
57
80
 
58
- speech = response.parse()
59
- assert_matches_type(object, speech, path=["response"])
81
+ assert speech.json() == {"foo": "bar"}
82
+ assert cast(Any, speech.is_closed) is True
83
+ assert isinstance(speech, StreamedBinaryAPIResponse)
60
84
 
61
- assert cast(Any, response.is_closed) is True
85
+ assert cast(Any, speech.is_closed) is True
62
86
 
63
87
  @parametrize
64
88
  def test_method_transcribe(self, client: Spitch) -> None:
@@ -72,6 +96,8 @@ class TestSpeech:
72
96
  speech = client.speech.transcribe(
73
97
  language="yo",
74
98
  content=b"raw file contents",
99
+ multispeaker=True,
100
+ timestamp=True,
75
101
  url="url",
76
102
  )
77
103
  assert_matches_type(object, speech, path=["response"])
@@ -105,48 +131,64 @@ class TestAsyncSpeech:
105
131
  parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
106
132
 
107
133
  @parametrize
108
- async def test_method_generate(self, async_client: AsyncSpitch) -> None:
134
+ @pytest.mark.respx(base_url=base_url)
135
+ async def test_method_generate(self, async_client: AsyncSpitch, respx_mock: MockRouter) -> None:
136
+ respx_mock.post("/v1/speech").mock(return_value=httpx.Response(200, json={"foo": "bar"}))
109
137
  speech = await async_client.speech.generate(
110
138
  language="yo",
111
139
  text="text",
112
140
  )
113
- assert_matches_type(object, speech, path=["response"])
141
+ assert speech.is_closed
142
+ assert await speech.json() == {"foo": "bar"}
143
+ assert cast(Any, speech.is_closed) is True
144
+ assert isinstance(speech, AsyncBinaryAPIResponse)
114
145
 
115
146
  @parametrize
116
- async def test_method_generate_with_all_params(self, async_client: AsyncSpitch) -> None:
147
+ @pytest.mark.respx(base_url=base_url)
148
+ async def test_method_generate_with_all_params(self, async_client: AsyncSpitch, respx_mock: MockRouter) -> None:
149
+ respx_mock.post("/v1/speech").mock(return_value=httpx.Response(200, json={"foo": "bar"}))
117
150
  speech = await async_client.speech.generate(
118
151
  language="yo",
119
152
  text="text",
120
153
  stream=True,
121
154
  voice="sade",
122
155
  )
123
- assert_matches_type(object, speech, path=["response"])
156
+ assert speech.is_closed
157
+ assert await speech.json() == {"foo": "bar"}
158
+ assert cast(Any, speech.is_closed) is True
159
+ assert isinstance(speech, AsyncBinaryAPIResponse)
124
160
 
125
161
  @parametrize
126
- async def test_raw_response_generate(self, async_client: AsyncSpitch) -> None:
127
- response = await async_client.speech.with_raw_response.generate(
162
+ @pytest.mark.respx(base_url=base_url)
163
+ async def test_raw_response_generate(self, async_client: AsyncSpitch, respx_mock: MockRouter) -> None:
164
+ respx_mock.post("/v1/speech").mock(return_value=httpx.Response(200, json={"foo": "bar"}))
165
+
166
+ speech = await async_client.speech.with_raw_response.generate(
128
167
  language="yo",
129
168
  text="text",
130
169
  )
131
170
 
132
- assert response.is_closed is True
133
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
134
- speech = await response.parse()
135
- assert_matches_type(object, speech, path=["response"])
171
+ assert speech.is_closed is True
172
+ assert speech.http_request.headers.get("X-Stainless-Lang") == "python"
173
+ assert await speech.json() == {"foo": "bar"}
174
+ assert isinstance(speech, AsyncBinaryAPIResponse)
136
175
 
137
176
  @parametrize
138
- async def test_streaming_response_generate(self, async_client: AsyncSpitch) -> None:
177
+ @pytest.mark.respx(base_url=base_url)
178
+ async def test_streaming_response_generate(self, async_client: AsyncSpitch, respx_mock: MockRouter) -> None:
179
+ respx_mock.post("/v1/speech").mock(return_value=httpx.Response(200, json={"foo": "bar"}))
139
180
  async with async_client.speech.with_streaming_response.generate(
140
181
  language="yo",
141
182
  text="text",
142
- ) as response:
143
- assert not response.is_closed
144
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
183
+ ) as speech:
184
+ assert not speech.is_closed
185
+ assert speech.http_request.headers.get("X-Stainless-Lang") == "python"
145
186
 
146
- speech = await response.parse()
147
- assert_matches_type(object, speech, path=["response"])
187
+ assert await speech.json() == {"foo": "bar"}
188
+ assert cast(Any, speech.is_closed) is True
189
+ assert isinstance(speech, AsyncStreamedBinaryAPIResponse)
148
190
 
149
- assert cast(Any, response.is_closed) is True
191
+ assert cast(Any, speech.is_closed) is True
150
192
 
151
193
  @parametrize
152
194
  async def test_method_transcribe(self, async_client: AsyncSpitch) -> None:
@@ -160,6 +202,8 @@ class TestAsyncSpeech:
160
202
  speech = await async_client.speech.transcribe(
161
203
  language="yo",
162
204
  content=b"raw file contents",
205
+ multispeaker=True,
206
+ timestamp=True,
163
207
  url="url",
164
208
  )
165
209
  assert_matches_type(object, speech, path=["response"])
@@ -1,3 +0,0 @@
1
- {
2
- ".": "1.9.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
File without changes
File without changes