spitch 1.6.0__tar.gz → 1.8.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 (75) hide show
  1. spitch-1.8.0/.release-please-manifest.json +3 -0
  2. {spitch-1.6.0 → spitch-1.8.0}/CHANGELOG.md +17 -0
  3. {spitch-1.6.0 → spitch-1.8.0}/PKG-INFO +1 -8
  4. {spitch-1.6.0 → spitch-1.8.0}/README.md +0 -7
  5. spitch-1.8.0/api.md +25 -0
  6. {spitch-1.6.0 → spitch-1.8.0}/pyproject.toml +3 -2
  7. {spitch-1.6.0 → spitch-1.8.0}/requirements-dev.lock +1 -1
  8. {spitch-1.6.0 → spitch-1.8.0}/src/spitch/_version.py +1 -1
  9. {spitch-1.6.0 → spitch-1.8.0}/src/spitch/resources/speech.py +43 -37
  10. {spitch-1.6.0 → spitch-1.8.0}/src/spitch/resources/text.py +95 -1
  11. {spitch-1.6.0 → spitch-1.8.0}/src/spitch/types/__init__.py +2 -1
  12. {spitch-1.6.0 → spitch-1.8.0}/src/spitch/types/speech_generate_params.py +3 -1
  13. spitch-1.8.0/src/spitch/types/speech_transcribe_params.py +22 -0
  14. spitch-1.8.0/src/spitch/types/text_translate_params.py +15 -0
  15. spitch-1.8.0/tests/api_resources/test_speech.py +193 -0
  16. {spitch-1.6.0 → spitch-1.8.0}/tests/api_resources/test_text.py +74 -0
  17. {spitch-1.6.0 → spitch-1.8.0}/tests/test_client.py +10 -10
  18. {spitch-1.6.0 → spitch-1.8.0}/tests/test_models.py +1 -1
  19. spitch-1.6.0/.release-please-manifest.json +0 -3
  20. spitch-1.6.0/api.md +0 -24
  21. spitch-1.6.0/tests/api_resources/test_speech.py +0 -205
  22. {spitch-1.6.0 → spitch-1.8.0}/.gitignore +0 -0
  23. {spitch-1.6.0 → spitch-1.8.0}/CONTRIBUTING.md +0 -0
  24. {spitch-1.6.0 → spitch-1.8.0}/LICENSE +0 -0
  25. {spitch-1.6.0 → spitch-1.8.0}/SECURITY.md +0 -0
  26. {spitch-1.6.0 → spitch-1.8.0}/bin/check-release-environment +0 -0
  27. {spitch-1.6.0 → spitch-1.8.0}/bin/publish-pypi +0 -0
  28. {spitch-1.6.0 → spitch-1.8.0}/examples/.keep +0 -0
  29. {spitch-1.6.0 → spitch-1.8.0}/examples/example.py +0 -0
  30. {spitch-1.6.0 → spitch-1.8.0}/mypy.ini +0 -0
  31. {spitch-1.6.0 → spitch-1.8.0}/noxfile.py +0 -0
  32. {spitch-1.6.0 → spitch-1.8.0}/release-please-config.json +0 -0
  33. {spitch-1.6.0 → spitch-1.8.0}/requirements.lock +0 -0
  34. {spitch-1.6.0 → spitch-1.8.0}/src/spitch/__init__.py +0 -0
  35. {spitch-1.6.0 → spitch-1.8.0}/src/spitch/_base_client.py +0 -0
  36. {spitch-1.6.0 → spitch-1.8.0}/src/spitch/_client.py +0 -0
  37. {spitch-1.6.0 → spitch-1.8.0}/src/spitch/_compat.py +0 -0
  38. {spitch-1.6.0 → spitch-1.8.0}/src/spitch/_constants.py +0 -0
  39. {spitch-1.6.0 → spitch-1.8.0}/src/spitch/_exceptions.py +0 -0
  40. {spitch-1.6.0 → spitch-1.8.0}/src/spitch/_files.py +0 -0
  41. {spitch-1.6.0 → spitch-1.8.0}/src/spitch/_models.py +0 -0
  42. {spitch-1.6.0 → spitch-1.8.0}/src/spitch/_qs.py +0 -0
  43. {spitch-1.6.0 → spitch-1.8.0}/src/spitch/_resource.py +0 -0
  44. {spitch-1.6.0 → spitch-1.8.0}/src/spitch/_response.py +0 -0
  45. {spitch-1.6.0 → spitch-1.8.0}/src/spitch/_streaming.py +0 -0
  46. {spitch-1.6.0 → spitch-1.8.0}/src/spitch/_types.py +0 -0
  47. {spitch-1.6.0 → spitch-1.8.0}/src/spitch/_utils/__init__.py +0 -0
  48. {spitch-1.6.0 → spitch-1.8.0}/src/spitch/_utils/_logs.py +0 -0
  49. {spitch-1.6.0 → spitch-1.8.0}/src/spitch/_utils/_proxy.py +0 -0
  50. {spitch-1.6.0 → spitch-1.8.0}/src/spitch/_utils/_reflection.py +0 -0
  51. {spitch-1.6.0 → spitch-1.8.0}/src/spitch/_utils/_streams.py +0 -0
  52. {spitch-1.6.0 → spitch-1.8.0}/src/spitch/_utils/_sync.py +0 -0
  53. {spitch-1.6.0 → spitch-1.8.0}/src/spitch/_utils/_transform.py +0 -0
  54. {spitch-1.6.0 → spitch-1.8.0}/src/spitch/_utils/_typing.py +0 -0
  55. {spitch-1.6.0 → spitch-1.8.0}/src/spitch/_utils/_utils.py +0 -0
  56. {spitch-1.6.0 → spitch-1.8.0}/src/spitch/lib/.keep +0 -0
  57. {spitch-1.6.0 → spitch-1.8.0}/src/spitch/py.typed +0 -0
  58. {spitch-1.6.0 → spitch-1.8.0}/src/spitch/resources/__init__.py +0 -0
  59. {spitch-1.6.0 → spitch-1.8.0}/src/spitch/types/speech_transcibe_params.py +0 -0
  60. {spitch-1.6.0 → spitch-1.8.0}/src/spitch/types/text_tone_mark_params.py +0 -0
  61. {spitch-1.6.0 → spitch-1.8.0}/tests/__init__.py +0 -0
  62. {spitch-1.6.0 → spitch-1.8.0}/tests/api_resources/__init__.py +0 -0
  63. {spitch-1.6.0 → spitch-1.8.0}/tests/conftest.py +0 -0
  64. {spitch-1.6.0 → spitch-1.8.0}/tests/sample_file.txt +0 -0
  65. {spitch-1.6.0 → spitch-1.8.0}/tests/test_deepcopy.py +0 -0
  66. {spitch-1.6.0 → spitch-1.8.0}/tests/test_extract_files.py +0 -0
  67. {spitch-1.6.0 → spitch-1.8.0}/tests/test_files.py +0 -0
  68. {spitch-1.6.0 → spitch-1.8.0}/tests/test_qs.py +0 -0
  69. {spitch-1.6.0 → spitch-1.8.0}/tests/test_required_args.py +0 -0
  70. {spitch-1.6.0 → spitch-1.8.0}/tests/test_response.py +0 -0
  71. {spitch-1.6.0 → spitch-1.8.0}/tests/test_streaming.py +0 -0
  72. {spitch-1.6.0 → spitch-1.8.0}/tests/test_transform.py +0 -0
  73. {spitch-1.6.0 → spitch-1.8.0}/tests/test_utils/test_proxy.py +0 -0
  74. {spitch-1.6.0 → spitch-1.8.0}/tests/test_utils/test_typing.py +0 -0
  75. {spitch-1.6.0 → spitch-1.8.0}/tests/utils.py +0 -0
@@ -0,0 +1,3 @@
1
+ {
2
+ ".": "1.8.0"
3
+ }
@@ -1,5 +1,22 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.8.0 (2024-10-17)
4
+
5
+ Full Changelog: [v1.7.0...v1.8.0](https://github.com/spi-tch/spitch-python/compare/v1.7.0...v1.8.0)
6
+
7
+ ### Features
8
+
9
+ * **api:** api update ([#37](https://github.com/spi-tch/spitch-python/issues/37)) ([34e4fba](https://github.com/spi-tch/spitch-python/commit/34e4fba09e3744cfb443a3a0de5bf6a59bac50bc))
10
+ * **api:** api update ([#39](https://github.com/spi-tch/spitch-python/issues/39)) ([4cc3eb2](https://github.com/spi-tch/spitch-python/commit/4cc3eb24be8de66ae662de62c45818c0100bf894))
11
+
12
+ ## 1.7.0 (2024-10-14)
13
+
14
+ Full Changelog: [v1.6.0...v1.7.0](https://github.com/spi-tch/spitch-python/compare/v1.6.0...v1.7.0)
15
+
16
+ ### Features
17
+
18
+ * **api:** api update ([#34](https://github.com/spi-tch/spitch-python/issues/34)) ([1cfe384](https://github.com/spi-tch/spitch-python/commit/1cfe38416d8c82453609132080a167c0ab735f51))
19
+
3
20
  ## 1.6.0 (2024-10-07)
4
21
 
5
22
  Full Changelog: [v1.5.0...v1.6.0](https://github.com/spi-tch/spitch-python/compare/v1.5.0...v1.6.0)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: spitch
3
- Version: 1.6.0
3
+ Version: 1.8.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
@@ -69,7 +69,6 @@ client = Spitch(
69
69
  response = client.speech.generate(
70
70
  language="yo",
71
71
  text="text",
72
- voice="sade",
73
72
  )
74
73
  ```
75
74
 
@@ -97,7 +96,6 @@ async def main() -> None:
97
96
  response = await client.speech.generate(
98
97
  language="yo",
99
98
  text="text",
100
- voice="sade",
101
99
  )
102
100
 
103
101
 
@@ -134,7 +132,6 @@ try:
134
132
  client.speech.generate(
135
133
  language="yo",
136
134
  text="text",
137
- voice="sade",
138
135
  )
139
136
  except spitch.APIConnectionError as e:
140
137
  print("The server could not be reached")
@@ -181,7 +178,6 @@ client = Spitch(
181
178
  client.with_options(max_retries=5).speech.generate(
182
179
  language="yo",
183
180
  text="text",
184
- voice="sade",
185
181
  )
186
182
  ```
187
183
 
@@ -208,7 +204,6 @@ client = Spitch(
208
204
  client.with_options(timeout=5.0).speech.generate(
209
205
  language="yo",
210
206
  text="text",
211
- voice="sade",
212
207
  )
213
208
  ```
214
209
 
@@ -251,7 +246,6 @@ client = Spitch()
251
246
  response = client.speech.with_raw_response.generate(
252
247
  language="yo",
253
248
  text="text",
254
- voice="sade",
255
249
  )
256
250
  print(response.headers.get('X-My-Header'))
257
251
 
@@ -273,7 +267,6 @@ To stream the response body, use `.with_streaming_response` instead, which requi
273
267
  with client.speech.with_streaming_response.generate(
274
268
  language="yo",
275
269
  text="text",
276
- voice="sade",
277
270
  ) as response:
278
271
  print(response.headers.get("X-My-Header"))
279
272
 
@@ -35,7 +35,6 @@ client = Spitch(
35
35
  response = client.speech.generate(
36
36
  language="yo",
37
37
  text="text",
38
- voice="sade",
39
38
  )
40
39
  ```
41
40
 
@@ -63,7 +62,6 @@ async def main() -> None:
63
62
  response = await client.speech.generate(
64
63
  language="yo",
65
64
  text="text",
66
- voice="sade",
67
65
  )
68
66
 
69
67
 
@@ -100,7 +98,6 @@ try:
100
98
  client.speech.generate(
101
99
  language="yo",
102
100
  text="text",
103
- voice="sade",
104
101
  )
105
102
  except spitch.APIConnectionError as e:
106
103
  print("The server could not be reached")
@@ -147,7 +144,6 @@ client = Spitch(
147
144
  client.with_options(max_retries=5).speech.generate(
148
145
  language="yo",
149
146
  text="text",
150
- voice="sade",
151
147
  )
152
148
  ```
153
149
 
@@ -174,7 +170,6 @@ client = Spitch(
174
170
  client.with_options(timeout=5.0).speech.generate(
175
171
  language="yo",
176
172
  text="text",
177
- voice="sade",
178
173
  )
179
174
  ```
180
175
 
@@ -217,7 +212,6 @@ client = Spitch()
217
212
  response = client.speech.with_raw_response.generate(
218
213
  language="yo",
219
214
  text="text",
220
- voice="sade",
221
215
  )
222
216
  print(response.headers.get('X-My-Header'))
223
217
 
@@ -239,7 +233,6 @@ To stream the response body, use `.with_streaming_response` instead, which requi
239
233
  with client.speech.with_streaming_response.generate(
240
234
  language="yo",
241
235
  text="text",
242
- voice="sade",
243
236
  ) as response:
244
237
  print(response.headers.get("X-My-Header"))
245
238
 
spitch-1.8.0/api.md ADDED
@@ -0,0 +1,25 @@
1
+ # Speech
2
+
3
+ Types:
4
+
5
+ ```python
6
+ from spitch.types import SpeechGenerateResponse, SpeechTranscribeResponse
7
+ ```
8
+
9
+ Methods:
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>
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
+
14
+ # Text
15
+
16
+ Types:
17
+
18
+ ```python
19
+ from spitch.types import TextToneMarkResponse, TextTranslateResponse
20
+ ```
21
+
22
+ Methods:
23
+
24
+ - <code title="post /v1/diacritics">client.text.<a href="./src/spitch/resources/text.py">tone_mark</a>(\*\*<a href="src/spitch/types/text_tone_mark_params.py">params</a>) -> <a href="./src/spitch/types/text_tone_mark_response.py">object</a></code>
25
+ - <code title="post /v1/translate">client.text.<a href="./src/spitch/resources/text.py">translate</a>(\*\*<a href="src/spitch/types/text_translate_params.py">params</a>) -> <a href="./src/spitch/types/text_translate_response.py">object</a></code>
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "spitch"
3
- version = "1.6.0"
3
+ version = "1.8.0"
4
4
  description = "The official Python library for the spitch API"
5
5
  dynamic = ["readme"]
6
6
  license = "Apache-2.0"
@@ -63,11 +63,12 @@ format = { chain = [
63
63
  "format:ruff",
64
64
  "format:docs",
65
65
  "fix:ruff",
66
+ # run formatting again to fix any inconsistencies when imports are stripped
67
+ "format:ruff",
66
68
  ]}
67
69
  "format:black" = "black ."
68
70
  "format:docs" = "python scripts/utils/ruffen-docs.py README.md api.md"
69
71
  "format:ruff" = "ruff format"
70
- "format:isort" = "isort ."
71
72
 
72
73
  "lint" = { chain = [
73
74
  "check:ruff",
@@ -80,7 +80,7 @@ pytz==2023.3.post1
80
80
  # via dirty-equals
81
81
  respx==0.20.2
82
82
  rich==13.7.1
83
- ruff==0.6.5
83
+ ruff==0.6.9
84
84
  setuptools==68.2.2
85
85
  # via nodeenv
86
86
  six==1.16.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.6.0" # x-release-please-version
4
+ __version__ = "1.8.0" # x-release-please-version
@@ -7,7 +7,7 @@ from typing_extensions import Literal
7
7
 
8
8
  import httpx
9
9
 
10
- from ..types import speech_generate_params, speech_transcibe_params
10
+ from ..types import speech_generate_params, speech_transcribe_params
11
11
  from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven, FileTypes
12
12
  from .._utils import (
13
13
  extract_files,
@@ -18,18 +18,10 @@ 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,
25
21
  to_raw_response_wrapper,
26
22
  to_streamed_response_wrapper,
27
23
  async_to_raw_response_wrapper,
28
- to_custom_raw_response_wrapper,
29
24
  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,
33
25
  )
34
26
  from .._base_client import make_request_options
35
27
 
@@ -61,14 +53,15 @@ class SpeechResource(SyncAPIResource):
61
53
  *,
62
54
  language: Literal["yo", "en", "ha", "ig"],
63
55
  text: str,
64
- voice: Literal["sade", "segun", "femi", "funmi"],
56
+ stream: bool | NotGiven = NOT_GIVEN,
57
+ voice: Literal["sade", "segun", "femi", "funmi"] | NotGiven = NOT_GIVEN,
65
58
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
66
59
  # The extra values given here take precedence over values defined on the client or passed to this method.
67
60
  extra_headers: Headers | None = None,
68
61
  extra_query: Query | None = None,
69
62
  extra_body: Body | None = None,
70
63
  timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
71
- ) -> BinaryAPIResponse:
64
+ ) -> object:
72
65
  """
73
66
  Synthesize
74
67
 
@@ -81,7 +74,6 @@ class SpeechResource(SyncAPIResource):
81
74
 
82
75
  timeout: Override the client-level default timeout for this request, in seconds
83
76
  """
84
- extra_headers = {"Accept": "audio/wav", **(extra_headers or {})}
85
77
  return self._post(
86
78
  "/v1/speech",
87
79
  body=maybe_transform(
@@ -93,16 +85,22 @@ class SpeechResource(SyncAPIResource):
93
85
  speech_generate_params.SpeechGenerateParams,
94
86
  ),
95
87
  options=make_request_options(
96
- extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
88
+ extra_headers=extra_headers,
89
+ extra_query=extra_query,
90
+ extra_body=extra_body,
91
+ timeout=timeout,
92
+ query=maybe_transform({"stream": stream}, speech_generate_params.SpeechGenerateParams),
97
93
  ),
98
- cast_to=BinaryAPIResponse,
94
+ cast_to=object,
99
95
  )
100
96
 
101
- def transcibe(
97
+ def transcribe(
102
98
  self,
103
99
  *,
104
100
  language: Literal["yo", "en", "ha", "ig"],
105
101
  content: Optional[FileTypes] | NotGiven = NOT_GIVEN,
102
+ multispeaker: Optional[bool] | NotGiven = NOT_GIVEN,
103
+ timestamp: Optional[bool] | NotGiven = NOT_GIVEN,
106
104
  url: Optional[str] | NotGiven = NOT_GIVEN,
107
105
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
108
106
  # The extra values given here take precedence over values defined on the client or passed to this method.
@@ -127,6 +125,8 @@ class SpeechResource(SyncAPIResource):
127
125
  {
128
126
  "language": language,
129
127
  "content": content,
128
+ "multispeaker": multispeaker,
129
+ "timestamp": timestamp,
130
130
  "url": url,
131
131
  }
132
132
  )
@@ -137,7 +137,7 @@ class SpeechResource(SyncAPIResource):
137
137
  extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}
138
138
  return self._post(
139
139
  "/v1/transcriptions",
140
- body=maybe_transform(body, speech_transcibe_params.SpeechTranscibeParams),
140
+ body=maybe_transform(body, speech_transcribe_params.SpeechTranscribeParams),
141
141
  files=files,
142
142
  options=make_request_options(
143
143
  extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
@@ -171,14 +171,15 @@ class AsyncSpeechResource(AsyncAPIResource):
171
171
  *,
172
172
  language: Literal["yo", "en", "ha", "ig"],
173
173
  text: str,
174
- voice: Literal["sade", "segun", "femi", "funmi"],
174
+ stream: bool | NotGiven = NOT_GIVEN,
175
+ voice: Literal["sade", "segun", "femi", "funmi"] | NotGiven = NOT_GIVEN,
175
176
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
176
177
  # The extra values given here take precedence over values defined on the client or passed to this method.
177
178
  extra_headers: Headers | None = None,
178
179
  extra_query: Query | None = None,
179
180
  extra_body: Body | None = None,
180
181
  timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
181
- ) -> AsyncBinaryAPIResponse:
182
+ ) -> object:
182
183
  """
183
184
  Synthesize
184
185
 
@@ -191,7 +192,6 @@ class AsyncSpeechResource(AsyncAPIResource):
191
192
 
192
193
  timeout: Override the client-level default timeout for this request, in seconds
193
194
  """
194
- extra_headers = {"Accept": "audio/wav", **(extra_headers or {})}
195
195
  return await self._post(
196
196
  "/v1/speech",
197
197
  body=await async_maybe_transform(
@@ -203,16 +203,22 @@ class AsyncSpeechResource(AsyncAPIResource):
203
203
  speech_generate_params.SpeechGenerateParams,
204
204
  ),
205
205
  options=make_request_options(
206
- extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
206
+ extra_headers=extra_headers,
207
+ extra_query=extra_query,
208
+ extra_body=extra_body,
209
+ timeout=timeout,
210
+ query=await async_maybe_transform({"stream": stream}, speech_generate_params.SpeechGenerateParams),
207
211
  ),
208
- cast_to=AsyncBinaryAPIResponse,
212
+ cast_to=object,
209
213
  )
210
214
 
211
- async def transcibe(
215
+ async def transcribe(
212
216
  self,
213
217
  *,
214
218
  language: Literal["yo", "en", "ha", "ig"],
215
219
  content: Optional[FileTypes] | NotGiven = NOT_GIVEN,
220
+ multispeaker: Optional[bool] | NotGiven = NOT_GIVEN,
221
+ timestamp: Optional[bool] | NotGiven = NOT_GIVEN,
216
222
  url: Optional[str] | NotGiven = NOT_GIVEN,
217
223
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
218
224
  # The extra values given here take precedence over values defined on the client or passed to this method.
@@ -237,6 +243,8 @@ class AsyncSpeechResource(AsyncAPIResource):
237
243
  {
238
244
  "language": language,
239
245
  "content": content,
246
+ "multispeaker": multispeaker,
247
+ "timestamp": timestamp,
240
248
  "url": url,
241
249
  }
242
250
  )
@@ -247,7 +255,7 @@ class AsyncSpeechResource(AsyncAPIResource):
247
255
  extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}
248
256
  return await self._post(
249
257
  "/v1/transcriptions",
250
- body=await async_maybe_transform(body, speech_transcibe_params.SpeechTranscibeParams),
258
+ body=await async_maybe_transform(body, speech_transcribe_params.SpeechTranscribeParams),
251
259
  files=files,
252
260
  options=make_request_options(
253
261
  extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
@@ -260,12 +268,11 @@ class SpeechResourceWithRawResponse:
260
268
  def __init__(self, speech: SpeechResource) -> None:
261
269
  self._speech = speech
262
270
 
263
- self.generate = to_custom_raw_response_wrapper(
271
+ self.generate = to_raw_response_wrapper(
264
272
  speech.generate,
265
- BinaryAPIResponse,
266
273
  )
267
- self.transcibe = to_raw_response_wrapper(
268
- speech.transcibe,
274
+ self.transcribe = to_raw_response_wrapper(
275
+ speech.transcribe,
269
276
  )
270
277
 
271
278
 
@@ -273,12 +280,11 @@ class AsyncSpeechResourceWithRawResponse:
273
280
  def __init__(self, speech: AsyncSpeechResource) -> None:
274
281
  self._speech = speech
275
282
 
276
- self.generate = async_to_custom_raw_response_wrapper(
283
+ self.generate = async_to_raw_response_wrapper(
277
284
  speech.generate,
278
- AsyncBinaryAPIResponse,
279
285
  )
280
- self.transcibe = async_to_raw_response_wrapper(
281
- speech.transcibe,
286
+ self.transcribe = async_to_raw_response_wrapper(
287
+ speech.transcribe,
282
288
  )
283
289
 
284
290
 
@@ -286,12 +292,12 @@ class SpeechResourceWithStreamingResponse:
286
292
  def __init__(self, speech: SpeechResource) -> None:
287
293
  self._speech = speech
288
294
 
289
- self.generate = to_custom_streamed_response_wrapper(
295
+ self.generate = to_streamed_response_wrapper(
290
296
  speech.generate,
291
297
  StreamedBinaryAPIResponse
292
298
  )
293
- self.transcibe = to_streamed_response_wrapper(
294
- speech.transcibe,
299
+ self.transcribe = to_streamed_response_wrapper(
300
+ speech.transcribe,
295
301
  )
296
302
 
297
303
 
@@ -299,10 +305,10 @@ class AsyncSpeechResourceWithStreamingResponse:
299
305
  def __init__(self, speech: AsyncSpeechResource) -> None:
300
306
  self._speech = speech
301
307
 
302
- self.generate = async_to_custom_streamed_response_wrapper(
308
+ self.generate = async_to_streamed_response_wrapper(
303
309
  speech.generate,
304
310
  AsyncStreamedBinaryAPIResponse
305
311
  )
306
- self.transcibe = async_to_streamed_response_wrapper(
307
- speech.transcibe,
312
+ self.transcribe = async_to_streamed_response_wrapper(
313
+ speech.transcribe,
308
314
  )
@@ -6,7 +6,7 @@ from typing_extensions import Literal
6
6
 
7
7
  import httpx
8
8
 
9
- from ..types import text_tone_mark_params
9
+ from ..types import text_tone_mark_params, text_translate_params
10
10
  from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
11
11
  from .._utils import (
12
12
  maybe_transform,
@@ -84,6 +84,47 @@ class TextResource(SyncAPIResource):
84
84
  cast_to=object,
85
85
  )
86
86
 
87
+ def translate(
88
+ self,
89
+ *,
90
+ source: Literal["yo", "en", "ha", "ig"],
91
+ target: Literal["yo", "en", "ha", "ig"],
92
+ text: str,
93
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
94
+ # The extra values given here take precedence over values defined on the client or passed to this method.
95
+ extra_headers: Headers | None = None,
96
+ extra_query: Query | None = None,
97
+ extra_body: Body | None = None,
98
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
99
+ ) -> object:
100
+ """
101
+ Translate
102
+
103
+ Args:
104
+ extra_headers: Send extra headers
105
+
106
+ extra_query: Add additional query parameters to the request
107
+
108
+ extra_body: Add additional JSON properties to the request
109
+
110
+ timeout: Override the client-level default timeout for this request, in seconds
111
+ """
112
+ return self._post(
113
+ "/v1/translate",
114
+ body=maybe_transform(
115
+ {
116
+ "source": source,
117
+ "target": target,
118
+ "text": text,
119
+ },
120
+ text_translate_params.TextTranslateParams,
121
+ ),
122
+ options=make_request_options(
123
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
124
+ ),
125
+ cast_to=object,
126
+ )
127
+
87
128
 
88
129
  class AsyncTextResource(AsyncAPIResource):
89
130
  @cached_property
@@ -144,6 +185,47 @@ class AsyncTextResource(AsyncAPIResource):
144
185
  cast_to=object,
145
186
  )
146
187
 
188
+ async def translate(
189
+ self,
190
+ *,
191
+ source: Literal["yo", "en", "ha", "ig"],
192
+ target: Literal["yo", "en", "ha", "ig"],
193
+ text: str,
194
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
195
+ # The extra values given here take precedence over values defined on the client or passed to this method.
196
+ extra_headers: Headers | None = None,
197
+ extra_query: Query | None = None,
198
+ extra_body: Body | None = None,
199
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
200
+ ) -> object:
201
+ """
202
+ Translate
203
+
204
+ Args:
205
+ extra_headers: Send extra headers
206
+
207
+ extra_query: Add additional query parameters to the request
208
+
209
+ extra_body: Add additional JSON properties to the request
210
+
211
+ timeout: Override the client-level default timeout for this request, in seconds
212
+ """
213
+ return await self._post(
214
+ "/v1/translate",
215
+ body=await async_maybe_transform(
216
+ {
217
+ "source": source,
218
+ "target": target,
219
+ "text": text,
220
+ },
221
+ text_translate_params.TextTranslateParams,
222
+ ),
223
+ options=make_request_options(
224
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
225
+ ),
226
+ cast_to=object,
227
+ )
228
+
147
229
 
148
230
  class TextResourceWithRawResponse:
149
231
  def __init__(self, text: TextResource) -> None:
@@ -152,6 +234,9 @@ class TextResourceWithRawResponse:
152
234
  self.tone_mark = to_raw_response_wrapper(
153
235
  text.tone_mark,
154
236
  )
237
+ self.translate = to_raw_response_wrapper(
238
+ text.translate,
239
+ )
155
240
 
156
241
 
157
242
  class AsyncTextResourceWithRawResponse:
@@ -161,6 +246,9 @@ class AsyncTextResourceWithRawResponse:
161
246
  self.tone_mark = async_to_raw_response_wrapper(
162
247
  text.tone_mark,
163
248
  )
249
+ self.translate = async_to_raw_response_wrapper(
250
+ text.translate,
251
+ )
164
252
 
165
253
 
166
254
  class TextResourceWithStreamingResponse:
@@ -170,6 +258,9 @@ class TextResourceWithStreamingResponse:
170
258
  self.tone_mark = to_streamed_response_wrapper(
171
259
  text.tone_mark,
172
260
  )
261
+ self.translate = to_streamed_response_wrapper(
262
+ text.translate,
263
+ )
173
264
 
174
265
 
175
266
  class AsyncTextResourceWithStreamingResponse:
@@ -179,3 +270,6 @@ class AsyncTextResourceWithStreamingResponse:
179
270
  self.tone_mark = async_to_streamed_response_wrapper(
180
271
  text.tone_mark,
181
272
  )
273
+ self.translate = async_to_streamed_response_wrapper(
274
+ text.translate,
275
+ )
@@ -3,5 +3,6 @@
3
3
  from __future__ import annotations
4
4
 
5
5
  from .text_tone_mark_params import TextToneMarkParams as TextToneMarkParams
6
+ from .text_translate_params import TextTranslateParams as TextTranslateParams
6
7
  from .speech_generate_params import SpeechGenerateParams as SpeechGenerateParams
7
- from .speech_transcibe_params import SpeechTranscibeParams as SpeechTranscibeParams
8
+ from .speech_transcribe_params import SpeechTranscribeParams as SpeechTranscribeParams
@@ -12,4 +12,6 @@ class SpeechGenerateParams(TypedDict, total=False):
12
12
 
13
13
  text: Required[str]
14
14
 
15
- voice: Required[Literal["sade", "segun", "femi", "funmi"]]
15
+ stream: bool
16
+
17
+ voice: Literal["sade", "segun", "femi", "funmi"]
@@ -0,0 +1,22 @@
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__ = ["SpeechTranscribeParams"]
11
+
12
+
13
+ class SpeechTranscribeParams(TypedDict, total=False):
14
+ language: Required[Literal["yo", "en", "ha", "ig"]]
15
+
16
+ content: Optional[FileTypes]
17
+
18
+ multispeaker: Optional[bool]
19
+
20
+ timestamp: Optional[bool]
21
+
22
+ url: Optional[str]
@@ -0,0 +1,15 @@
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__ = ["TextTranslateParams"]
8
+
9
+
10
+ class TextTranslateParams(TypedDict, total=False):
11
+ source: Required[Literal["yo", "en", "ha", "ig"]]
12
+
13
+ target: Required[Literal["yo", "en", "ha", "ig"]]
14
+
15
+ text: Required[str]