together 1.5.35__py3-none-any.whl → 2.0.0a6__py3-none-any.whl
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.
- together/__init__.py +101 -114
- together/_base_client.py +1995 -0
- together/_client.py +1033 -0
- together/_compat.py +219 -0
- together/_constants.py +14 -0
- together/_exceptions.py +108 -0
- together/_files.py +123 -0
- together/_models.py +857 -0
- together/_qs.py +150 -0
- together/_resource.py +43 -0
- together/_response.py +830 -0
- together/_streaming.py +370 -0
- together/_types.py +260 -0
- together/_utils/__init__.py +64 -0
- together/_utils/_compat.py +45 -0
- together/_utils/_datetime_parse.py +136 -0
- together/_utils/_logs.py +25 -0
- together/_utils/_proxy.py +65 -0
- together/_utils/_reflection.py +42 -0
- together/_utils/_resources_proxy.py +24 -0
- together/_utils/_streams.py +12 -0
- together/_utils/_sync.py +58 -0
- together/_utils/_transform.py +457 -0
- together/_utils/_typing.py +156 -0
- together/_utils/_utils.py +421 -0
- together/_version.py +4 -0
- together/lib/.keep +4 -0
- together/lib/__init__.py +23 -0
- together/{cli → lib/cli}/api/endpoints.py +66 -84
- together/{cli/api/evaluation.py → lib/cli/api/evals.py} +152 -43
- together/{cli → lib/cli}/api/files.py +20 -17
- together/{cli/api/finetune.py → lib/cli/api/fine_tuning.py} +116 -172
- together/{cli → lib/cli}/api/models.py +34 -27
- together/lib/cli/api/utils.py +50 -0
- together/{cli → lib/cli}/cli.py +16 -26
- together/{constants.py → lib/constants.py} +11 -24
- together/lib/resources/__init__.py +11 -0
- together/lib/resources/files.py +999 -0
- together/lib/resources/fine_tuning.py +280 -0
- together/lib/resources/models.py +35 -0
- together/lib/types/__init__.py +13 -0
- together/lib/types/error.py +9 -0
- together/lib/types/fine_tuning.py +397 -0
- together/{utils → lib/utils}/__init__.py +6 -14
- together/{utils → lib/utils}/_log.py +11 -16
- together/{utils → lib/utils}/files.py +90 -288
- together/lib/utils/serializer.py +10 -0
- together/{utils → lib/utils}/tools.py +19 -55
- together/resources/__init__.py +225 -39
- together/resources/audio/__init__.py +72 -48
- together/resources/audio/audio.py +198 -0
- together/resources/audio/speech.py +574 -128
- together/resources/audio/transcriptions.py +247 -261
- together/resources/audio/translations.py +221 -241
- together/resources/audio/voices.py +111 -41
- together/resources/batches.py +417 -0
- together/resources/chat/__init__.py +30 -21
- together/resources/chat/chat.py +102 -0
- together/resources/chat/completions.py +1063 -263
- together/resources/code_interpreter/__init__.py +33 -0
- together/resources/code_interpreter/code_interpreter.py +258 -0
- together/resources/code_interpreter/sessions.py +135 -0
- together/resources/completions.py +884 -225
- together/resources/embeddings.py +172 -68
- together/resources/endpoints.py +589 -490
- together/resources/evals.py +452 -0
- together/resources/files.py +397 -129
- together/resources/fine_tuning.py +1033 -0
- together/resources/hardware.py +181 -0
- together/resources/images.py +258 -104
- together/resources/jobs.py +214 -0
- together/resources/models.py +223 -193
- together/resources/rerank.py +190 -92
- together/resources/videos.py +286 -214
- together/types/__init__.py +66 -167
- together/types/audio/__init__.py +10 -0
- together/types/audio/speech_create_params.py +75 -0
- together/types/audio/transcription_create_params.py +54 -0
- together/types/audio/transcription_create_response.py +111 -0
- together/types/audio/translation_create_params.py +40 -0
- together/types/audio/translation_create_response.py +70 -0
- together/types/audio/voice_list_response.py +23 -0
- together/types/audio_speech_stream_chunk.py +16 -0
- together/types/autoscaling.py +13 -0
- together/types/autoscaling_param.py +15 -0
- together/types/batch_create_params.py +24 -0
- together/types/batch_create_response.py +14 -0
- together/types/batch_job.py +45 -0
- together/types/batch_list_response.py +10 -0
- together/types/chat/__init__.py +18 -0
- together/types/chat/chat_completion.py +60 -0
- together/types/chat/chat_completion_chunk.py +61 -0
- together/types/chat/chat_completion_structured_message_image_url_param.py +18 -0
- together/types/chat/chat_completion_structured_message_text_param.py +13 -0
- together/types/chat/chat_completion_structured_message_video_url_param.py +18 -0
- together/types/chat/chat_completion_usage.py +13 -0
- together/types/chat/chat_completion_warning.py +9 -0
- together/types/chat/completion_create_params.py +329 -0
- together/types/code_interpreter/__init__.py +5 -0
- together/types/code_interpreter/session_list_response.py +31 -0
- together/types/code_interpreter_execute_params.py +45 -0
- together/types/completion.py +42 -0
- together/types/completion_chunk.py +66 -0
- together/types/completion_create_params.py +138 -0
- together/types/dedicated_endpoint.py +44 -0
- together/types/embedding.py +24 -0
- together/types/embedding_create_params.py +31 -0
- together/types/endpoint_create_params.py +43 -0
- together/types/endpoint_list_avzones_response.py +11 -0
- together/types/endpoint_list_params.py +18 -0
- together/types/endpoint_list_response.py +41 -0
- together/types/endpoint_update_params.py +27 -0
- together/types/eval_create_params.py +263 -0
- together/types/eval_create_response.py +16 -0
- together/types/eval_list_params.py +21 -0
- together/types/eval_list_response.py +10 -0
- together/types/eval_status_response.py +100 -0
- together/types/evaluation_job.py +139 -0
- together/types/execute_response.py +108 -0
- together/types/file_delete_response.py +13 -0
- together/types/file_list.py +12 -0
- together/types/file_purpose.py +9 -0
- together/types/file_response.py +31 -0
- together/types/file_type.py +7 -0
- together/types/fine_tuning_cancel_response.py +194 -0
- together/types/fine_tuning_content_params.py +24 -0
- together/types/fine_tuning_delete_params.py +11 -0
- together/types/fine_tuning_delete_response.py +12 -0
- together/types/fine_tuning_list_checkpoints_response.py +21 -0
- together/types/fine_tuning_list_events_response.py +12 -0
- together/types/fine_tuning_list_response.py +199 -0
- together/types/finetune_event.py +41 -0
- together/types/finetune_event_type.py +33 -0
- together/types/finetune_response.py +177 -0
- together/types/hardware_list_params.py +16 -0
- together/types/hardware_list_response.py +58 -0
- together/types/image_data_b64.py +15 -0
- together/types/image_data_url.py +15 -0
- together/types/image_file.py +23 -0
- together/types/image_generate_params.py +85 -0
- together/types/job_list_response.py +47 -0
- together/types/job_retrieve_response.py +43 -0
- together/types/log_probs.py +18 -0
- together/types/model_list_response.py +10 -0
- together/types/model_object.py +42 -0
- together/types/model_upload_params.py +36 -0
- together/types/model_upload_response.py +23 -0
- together/types/rerank_create_params.py +36 -0
- together/types/rerank_create_response.py +36 -0
- together/types/tool_choice.py +23 -0
- together/types/tool_choice_param.py +23 -0
- together/types/tools_param.py +23 -0
- together/types/training_method_dpo.py +22 -0
- together/types/training_method_sft.py +18 -0
- together/types/video_create_params.py +86 -0
- together/types/video_create_response.py +10 -0
- together/types/video_job.py +57 -0
- together-2.0.0a6.dist-info/METADATA +729 -0
- together-2.0.0a6.dist-info/RECORD +165 -0
- {together-1.5.35.dist-info → together-2.0.0a6.dist-info}/WHEEL +1 -1
- together-2.0.0a6.dist-info/entry_points.txt +2 -0
- {together-1.5.35.dist-info → together-2.0.0a6.dist-info}/licenses/LICENSE +1 -1
- together/abstract/api_requestor.py +0 -770
- together/cli/api/chat.py +0 -298
- together/cli/api/completions.py +0 -119
- together/cli/api/images.py +0 -93
- together/cli/api/utils.py +0 -139
- together/client.py +0 -186
- together/error.py +0 -194
- together/filemanager.py +0 -635
- together/legacy/__init__.py +0 -0
- together/legacy/base.py +0 -27
- together/legacy/complete.py +0 -93
- together/legacy/embeddings.py +0 -27
- together/legacy/files.py +0 -146
- together/legacy/finetune.py +0 -177
- together/legacy/images.py +0 -27
- together/legacy/models.py +0 -44
- together/resources/batch.py +0 -165
- together/resources/code_interpreter.py +0 -82
- together/resources/evaluation.py +0 -808
- together/resources/finetune.py +0 -1388
- together/together_response.py +0 -50
- together/types/abstract.py +0 -26
- together/types/audio_speech.py +0 -311
- together/types/batch.py +0 -54
- together/types/chat_completions.py +0 -210
- together/types/code_interpreter.py +0 -57
- together/types/common.py +0 -67
- together/types/completions.py +0 -107
- together/types/embeddings.py +0 -35
- together/types/endpoints.py +0 -123
- together/types/error.py +0 -16
- together/types/evaluation.py +0 -93
- together/types/files.py +0 -93
- together/types/finetune.py +0 -465
- together/types/images.py +0 -42
- together/types/models.py +0 -96
- together/types/rerank.py +0 -43
- together/types/videos.py +0 -69
- together/utils/api_helpers.py +0 -124
- together/version.py +0 -6
- together-1.5.35.dist-info/METADATA +0 -583
- together-1.5.35.dist-info/RECORD +0 -77
- together-1.5.35.dist-info/entry_points.txt +0 -3
- /together/{abstract → lib/cli}/__init__.py +0 -0
- /together/{cli → lib/cli/api}/__init__.py +0 -0
- /together/{cli/api/__init__.py → py.typed} +0 -0
|
@@ -1,159 +1,605 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
1
3
|
from __future__ import annotations
|
|
2
4
|
|
|
3
|
-
from typing import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
5
|
+
from typing import Union
|
|
6
|
+
from typing_extensions import Literal, overload
|
|
7
|
+
|
|
8
|
+
import httpx
|
|
9
|
+
|
|
10
|
+
from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
|
|
11
|
+
from ..._utils import required_args, maybe_transform, async_maybe_transform
|
|
12
|
+
from ..._compat import cached_property
|
|
13
|
+
from ..._resource import SyncAPIResource, AsyncAPIResource
|
|
14
|
+
from ..._response import (
|
|
15
|
+
BinaryAPIResponse,
|
|
16
|
+
AsyncBinaryAPIResponse,
|
|
17
|
+
StreamedBinaryAPIResponse,
|
|
18
|
+
AsyncStreamedBinaryAPIResponse,
|
|
19
|
+
to_custom_raw_response_wrapper,
|
|
20
|
+
to_custom_streamed_response_wrapper,
|
|
21
|
+
async_to_custom_raw_response_wrapper,
|
|
22
|
+
async_to_custom_streamed_response_wrapper,
|
|
17
23
|
)
|
|
24
|
+
from ..._streaming import Stream, AsyncStream
|
|
25
|
+
from ...types.audio import speech_create_params
|
|
26
|
+
from ..._base_client import make_request_options
|
|
27
|
+
from ...types.audio_speech_stream_chunk import AudioSpeechStreamChunk
|
|
28
|
+
|
|
29
|
+
__all__ = ["SpeechResource", "AsyncSpeechResource"]
|
|
30
|
+
|
|
18
31
|
|
|
32
|
+
class SpeechResource(SyncAPIResource):
|
|
33
|
+
@cached_property
|
|
34
|
+
def with_raw_response(self) -> SpeechResourceWithRawResponse:
|
|
35
|
+
"""
|
|
36
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
37
|
+
the raw response object instead of the parsed content.
|
|
38
|
+
|
|
39
|
+
For more information, see https://www.github.com/togethercomputer/together-py#accessing-raw-response-data-eg-headers
|
|
40
|
+
"""
|
|
41
|
+
return SpeechResourceWithRawResponse(self)
|
|
42
|
+
|
|
43
|
+
@cached_property
|
|
44
|
+
def with_streaming_response(self) -> SpeechResourceWithStreamingResponse:
|
|
45
|
+
"""
|
|
46
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
19
47
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
self
|
|
48
|
+
For more information, see https://www.github.com/togethercomputer/together-py#with_streaming_response
|
|
49
|
+
"""
|
|
50
|
+
return SpeechResourceWithStreamingResponse(self)
|
|
23
51
|
|
|
52
|
+
@overload
|
|
24
53
|
def create(
|
|
25
54
|
self,
|
|
26
55
|
*,
|
|
27
|
-
model: str,
|
|
28
56
|
input: str,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
language:
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
57
|
+
model: Union[Literal["cartesia/sonic", "hexgrad/Kokoro-82M", "canopylabs/orpheus-3b-0.1-ft"], str],
|
|
58
|
+
voice: str,
|
|
59
|
+
language: Literal["en", "de", "fr", "es", "hi", "it", "ja", "ko", "nl", "pl", "pt", "ru", "sv", "tr", "zh"]
|
|
60
|
+
| Omit = omit,
|
|
61
|
+
response_encoding: Literal["pcm_f32le", "pcm_s16le", "pcm_mulaw", "pcm_alaw"] | Omit = omit,
|
|
62
|
+
response_format: Literal["mp3", "wav", "raw"] | Omit = omit,
|
|
63
|
+
sample_rate: int | Omit = omit,
|
|
64
|
+
stream: Literal[False] | Omit = omit,
|
|
65
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
66
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
67
|
+
extra_headers: Headers | None = None,
|
|
68
|
+
extra_query: Query | None = None,
|
|
69
|
+
extra_body: Body | None = None,
|
|
70
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
71
|
+
) -> BinaryAPIResponse:
|
|
37
72
|
"""
|
|
38
|
-
|
|
73
|
+
Generate audio from input text
|
|
39
74
|
|
|
40
75
|
Args:
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
76
|
+
input: Input text to generate the audio for
|
|
77
|
+
|
|
78
|
+
model: The name of the model to query.
|
|
79
|
+
|
|
80
|
+
[See all of Together AI's chat models](https://docs.together.ai/docs/serverless-models#audio-models)
|
|
81
|
+
The current supported tts models are: - cartesia/sonic - hexgrad/Kokoro-82M -
|
|
82
|
+
canopylabs/orpheus-3b-0.1-ft
|
|
83
|
+
|
|
84
|
+
voice: The voice to use for generating the audio. The voices supported are different
|
|
85
|
+
for each model. For eg - for canopylabs/orpheus-3b-0.1-ft, one of the voices
|
|
86
|
+
supported is tara, for hexgrad/Kokoro-82M, one of the voices supported is
|
|
87
|
+
af_alloy and for cartesia/sonic, one of the voices supported is "friendly
|
|
88
|
+
sidekick".
|
|
89
|
+
|
|
90
|
+
You can view the voices supported for each model using the /v1/voices endpoint
|
|
91
|
+
sending the model name as the query parameter.
|
|
92
|
+
[View all supported voices here](https://docs.together.ai/docs/text-to-speech#voices-available).
|
|
93
|
+
|
|
94
|
+
language: Language of input text.
|
|
95
|
+
|
|
96
|
+
response_encoding: Audio encoding of response
|
|
97
|
+
|
|
98
|
+
response_format: The format of audio output. Supported formats are mp3, wav, raw if streaming is
|
|
99
|
+
false. If streaming is true, the only supported format is raw.
|
|
100
|
+
|
|
101
|
+
sample_rate: Sampling rate to use for the output audio. The default sampling rate for
|
|
102
|
+
canopylabs/orpheus-3b-0.1-ft and hexgrad/Kokoro-82M is 24000 and for
|
|
103
|
+
cartesia/sonic is 44100.
|
|
104
|
+
|
|
105
|
+
stream: If true, output is streamed for several characters at a time instead of waiting
|
|
106
|
+
for the full response. The stream terminates with `data: [DONE]`. If false,
|
|
107
|
+
return the encoded audio as octet stream
|
|
108
|
+
|
|
109
|
+
extra_headers: Send extra headers
|
|
110
|
+
|
|
111
|
+
extra_query: Add additional query parameters to the request
|
|
112
|
+
|
|
113
|
+
extra_body: Add additional JSON properties to the request
|
|
114
|
+
|
|
115
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
116
|
+
"""
|
|
117
|
+
...
|
|
118
|
+
|
|
119
|
+
@overload
|
|
120
|
+
def create(
|
|
121
|
+
self,
|
|
122
|
+
*,
|
|
123
|
+
input: str,
|
|
124
|
+
model: Union[Literal["cartesia/sonic", "hexgrad/Kokoro-82M", "canopylabs/orpheus-3b-0.1-ft"], str],
|
|
125
|
+
stream: Literal[True],
|
|
126
|
+
voice: str,
|
|
127
|
+
language: Literal["en", "de", "fr", "es", "hi", "it", "ja", "ko", "nl", "pl", "pt", "ru", "sv", "tr", "zh"]
|
|
128
|
+
| Omit = omit,
|
|
129
|
+
response_encoding: Literal["pcm_f32le", "pcm_s16le", "pcm_mulaw", "pcm_alaw"] | Omit = omit,
|
|
130
|
+
response_format: Literal["mp3", "wav", "raw"] | Omit = omit,
|
|
131
|
+
sample_rate: int | Omit = omit,
|
|
132
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
133
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
134
|
+
extra_headers: Headers | None = None,
|
|
135
|
+
extra_query: Query | None = None,
|
|
136
|
+
extra_body: Body | None = None,
|
|
137
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
138
|
+
) -> Stream[AudioSpeechStreamChunk]:
|
|
139
|
+
"""
|
|
140
|
+
Generate audio from input text
|
|
141
|
+
|
|
142
|
+
Args:
|
|
143
|
+
input: Input text to generate the audio for
|
|
144
|
+
|
|
145
|
+
model: The name of the model to query.
|
|
146
|
+
|
|
147
|
+
[See all of Together AI's chat models](https://docs.together.ai/docs/serverless-models#audio-models)
|
|
148
|
+
The current supported tts models are: - cartesia/sonic - hexgrad/Kokoro-82M -
|
|
149
|
+
canopylabs/orpheus-3b-0.1-ft
|
|
150
|
+
|
|
151
|
+
stream: If true, output is streamed for several characters at a time instead of waiting
|
|
152
|
+
for the full response. The stream terminates with `data: [DONE]`. If false,
|
|
153
|
+
return the encoded audio as octet stream
|
|
154
|
+
|
|
155
|
+
voice: The voice to use for generating the audio. The voices supported are different
|
|
156
|
+
for each model. For eg - for canopylabs/orpheus-3b-0.1-ft, one of the voices
|
|
157
|
+
supported is tara, for hexgrad/Kokoro-82M, one of the voices supported is
|
|
158
|
+
af_alloy and for cartesia/sonic, one of the voices supported is "friendly
|
|
159
|
+
sidekick".
|
|
160
|
+
|
|
161
|
+
You can view the voices supported for each model using the /v1/voices endpoint
|
|
162
|
+
sending the model name as the query parameter.
|
|
163
|
+
[View all supported voices here](https://docs.together.ai/docs/text-to-speech#voices-available).
|
|
164
|
+
|
|
165
|
+
language: Language of input text.
|
|
69
166
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
167
|
+
response_encoding: Audio encoding of response
|
|
168
|
+
|
|
169
|
+
response_format: The format of audio output. Supported formats are mp3, wav, raw if streaming is
|
|
170
|
+
false. If streaming is true, the only supported format is raw.
|
|
171
|
+
|
|
172
|
+
sample_rate: Sampling rate to use for the output audio. The default sampling rate for
|
|
173
|
+
canopylabs/orpheus-3b-0.1-ft and hexgrad/Kokoro-82M is 24000 and for
|
|
174
|
+
cartesia/sonic is 44100.
|
|
175
|
+
|
|
176
|
+
extra_headers: Send extra headers
|
|
177
|
+
|
|
178
|
+
extra_query: Add additional query parameters to the request
|
|
179
|
+
|
|
180
|
+
extra_body: Add additional JSON properties to the request
|
|
181
|
+
|
|
182
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
183
|
+
"""
|
|
184
|
+
...
|
|
185
|
+
|
|
186
|
+
@overload
|
|
187
|
+
def create(
|
|
188
|
+
self,
|
|
189
|
+
*,
|
|
190
|
+
input: str,
|
|
191
|
+
model: Union[Literal["cartesia/sonic", "hexgrad/Kokoro-82M", "canopylabs/orpheus-3b-0.1-ft"], str],
|
|
192
|
+
stream: bool,
|
|
193
|
+
voice: str,
|
|
194
|
+
language: Literal["en", "de", "fr", "es", "hi", "it", "ja", "ko", "nl", "pl", "pt", "ru", "sv", "tr", "zh"]
|
|
195
|
+
| Omit = omit,
|
|
196
|
+
response_encoding: Literal["pcm_f32le", "pcm_s16le", "pcm_mulaw", "pcm_alaw"] | Omit = omit,
|
|
197
|
+
response_format: Literal["mp3", "wav", "raw"] | Omit = omit,
|
|
198
|
+
sample_rate: int | Omit = omit,
|
|
199
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
200
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
201
|
+
extra_headers: Headers | None = None,
|
|
202
|
+
extra_query: Query | None = None,
|
|
203
|
+
extra_body: Body | None = None,
|
|
204
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
205
|
+
) -> BinaryAPIResponse | Stream[AudioSpeechStreamChunk]:
|
|
206
|
+
"""
|
|
207
|
+
Generate audio from input text
|
|
208
|
+
|
|
209
|
+
Args:
|
|
210
|
+
input: Input text to generate the audio for
|
|
211
|
+
|
|
212
|
+
model: The name of the model to query.
|
|
213
|
+
|
|
214
|
+
[See all of Together AI's chat models](https://docs.together.ai/docs/serverless-models#audio-models)
|
|
215
|
+
The current supported tts models are: - cartesia/sonic - hexgrad/Kokoro-82M -
|
|
216
|
+
canopylabs/orpheus-3b-0.1-ft
|
|
217
|
+
|
|
218
|
+
stream: If true, output is streamed for several characters at a time instead of waiting
|
|
219
|
+
for the full response. The stream terminates with `data: [DONE]`. If false,
|
|
220
|
+
return the encoded audio as octet stream
|
|
221
|
+
|
|
222
|
+
voice: The voice to use for generating the audio. The voices supported are different
|
|
223
|
+
for each model. For eg - for canopylabs/orpheus-3b-0.1-ft, one of the voices
|
|
224
|
+
supported is tara, for hexgrad/Kokoro-82M, one of the voices supported is
|
|
225
|
+
af_alloy and for cartesia/sonic, one of the voices supported is "friendly
|
|
226
|
+
sidekick".
|
|
227
|
+
|
|
228
|
+
You can view the voices supported for each model using the /v1/voices endpoint
|
|
229
|
+
sending the model name as the query parameter.
|
|
230
|
+
[View all supported voices here](https://docs.together.ai/docs/text-to-speech#voices-available).
|
|
231
|
+
|
|
232
|
+
language: Language of input text.
|
|
233
|
+
|
|
234
|
+
response_encoding: Audio encoding of response
|
|
235
|
+
|
|
236
|
+
response_format: The format of audio output. Supported formats are mp3, wav, raw if streaming is
|
|
237
|
+
false. If streaming is true, the only supported format is raw.
|
|
238
|
+
|
|
239
|
+
sample_rate: Sampling rate to use for the output audio. The default sampling rate for
|
|
240
|
+
canopylabs/orpheus-3b-0.1-ft and hexgrad/Kokoro-82M is 24000 and for
|
|
241
|
+
cartesia/sonic is 44100.
|
|
242
|
+
|
|
243
|
+
extra_headers: Send extra headers
|
|
244
|
+
|
|
245
|
+
extra_query: Add additional query parameters to the request
|
|
246
|
+
|
|
247
|
+
extra_body: Add additional JSON properties to the request
|
|
248
|
+
|
|
249
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
250
|
+
"""
|
|
251
|
+
...
|
|
252
|
+
|
|
253
|
+
@required_args(["input", "model", "voice"], ["input", "model", "stream", "voice"])
|
|
254
|
+
def create(
|
|
255
|
+
self,
|
|
256
|
+
*,
|
|
257
|
+
input: str,
|
|
258
|
+
model: Union[Literal["cartesia/sonic", "hexgrad/Kokoro-82M", "canopylabs/orpheus-3b-0.1-ft"], str],
|
|
259
|
+
voice: str,
|
|
260
|
+
language: Literal["en", "de", "fr", "es", "hi", "it", "ja", "ko", "nl", "pl", "pt", "ru", "sv", "tr", "zh"]
|
|
261
|
+
| Omit = omit,
|
|
262
|
+
response_encoding: Literal["pcm_f32le", "pcm_s16le", "pcm_mulaw", "pcm_alaw"] | Omit = omit,
|
|
263
|
+
response_format: Literal["mp3", "wav", "raw"] | Omit = omit,
|
|
264
|
+
sample_rate: int | Omit = omit,
|
|
265
|
+
stream: Literal[False] | Literal[True] | Omit = omit,
|
|
266
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
267
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
268
|
+
extra_headers: Headers | None = None,
|
|
269
|
+
extra_query: Query | None = None,
|
|
270
|
+
extra_body: Body | None = None,
|
|
271
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
272
|
+
) -> BinaryAPIResponse | Stream[AudioSpeechStreamChunk]:
|
|
273
|
+
extra_headers = {"Accept": "application/octet-stream", **(extra_headers or {})}
|
|
274
|
+
return self._post(
|
|
275
|
+
"/audio/speech",
|
|
276
|
+
body=maybe_transform(
|
|
277
|
+
{
|
|
278
|
+
"input": input,
|
|
279
|
+
"model": model,
|
|
280
|
+
"voice": voice,
|
|
281
|
+
"language": language,
|
|
282
|
+
"response_encoding": response_encoding,
|
|
283
|
+
"response_format": response_format,
|
|
284
|
+
"sample_rate": sample_rate,
|
|
285
|
+
"stream": stream,
|
|
286
|
+
},
|
|
287
|
+
speech_create_params.SpeechCreateParamsStreaming
|
|
288
|
+
if stream
|
|
289
|
+
else speech_create_params.SpeechCreateParamsNonStreaming,
|
|
290
|
+
),
|
|
291
|
+
options=make_request_options(
|
|
292
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
87
293
|
),
|
|
88
|
-
|
|
294
|
+
cast_to=BinaryAPIResponse,
|
|
295
|
+
stream=stream or False,
|
|
296
|
+
stream_cls=Stream[AudioSpeechStreamChunk],
|
|
89
297
|
)
|
|
90
298
|
|
|
91
|
-
return AudioSpeechStreamResponse(response=response)
|
|
92
299
|
|
|
300
|
+
class AsyncSpeechResource(AsyncAPIResource):
|
|
301
|
+
@cached_property
|
|
302
|
+
def with_raw_response(self) -> AsyncSpeechResourceWithRawResponse:
|
|
303
|
+
"""
|
|
304
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
305
|
+
the raw response object instead of the parsed content.
|
|
306
|
+
|
|
307
|
+
For more information, see https://www.github.com/togethercomputer/together-py#accessing-raw-response-data-eg-headers
|
|
308
|
+
"""
|
|
309
|
+
return AsyncSpeechResourceWithRawResponse(self)
|
|
310
|
+
|
|
311
|
+
@cached_property
|
|
312
|
+
def with_streaming_response(self) -> AsyncSpeechResourceWithStreamingResponse:
|
|
313
|
+
"""
|
|
314
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
315
|
+
|
|
316
|
+
For more information, see https://www.github.com/togethercomputer/together-py#with_streaming_response
|
|
317
|
+
"""
|
|
318
|
+
return AsyncSpeechResourceWithStreamingResponse(self)
|
|
319
|
+
|
|
320
|
+
@overload
|
|
321
|
+
async def create(
|
|
322
|
+
self,
|
|
323
|
+
*,
|
|
324
|
+
input: str,
|
|
325
|
+
model: Union[Literal["cartesia/sonic", "hexgrad/Kokoro-82M", "canopylabs/orpheus-3b-0.1-ft"], str],
|
|
326
|
+
voice: str,
|
|
327
|
+
language: Literal["en", "de", "fr", "es", "hi", "it", "ja", "ko", "nl", "pl", "pt", "ru", "sv", "tr", "zh"]
|
|
328
|
+
| Omit = omit,
|
|
329
|
+
response_encoding: Literal["pcm_f32le", "pcm_s16le", "pcm_mulaw", "pcm_alaw"] | Omit = omit,
|
|
330
|
+
response_format: Literal["mp3", "wav", "raw"] | Omit = omit,
|
|
331
|
+
sample_rate: int | Omit = omit,
|
|
332
|
+
stream: Literal[False] | Omit = omit,
|
|
333
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
334
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
335
|
+
extra_headers: Headers | None = None,
|
|
336
|
+
extra_query: Query | None = None,
|
|
337
|
+
extra_body: Body | None = None,
|
|
338
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
339
|
+
) -> AsyncBinaryAPIResponse:
|
|
340
|
+
"""
|
|
341
|
+
Generate audio from input text
|
|
342
|
+
|
|
343
|
+
Args:
|
|
344
|
+
input: Input text to generate the audio for
|
|
345
|
+
|
|
346
|
+
model: The name of the model to query.
|
|
347
|
+
|
|
348
|
+
[See all of Together AI's chat models](https://docs.together.ai/docs/serverless-models#audio-models)
|
|
349
|
+
The current supported tts models are: - cartesia/sonic - hexgrad/Kokoro-82M -
|
|
350
|
+
canopylabs/orpheus-3b-0.1-ft
|
|
351
|
+
|
|
352
|
+
voice: The voice to use for generating the audio. The voices supported are different
|
|
353
|
+
for each model. For eg - for canopylabs/orpheus-3b-0.1-ft, one of the voices
|
|
354
|
+
supported is tara, for hexgrad/Kokoro-82M, one of the voices supported is
|
|
355
|
+
af_alloy and for cartesia/sonic, one of the voices supported is "friendly
|
|
356
|
+
sidekick".
|
|
357
|
+
|
|
358
|
+
You can view the voices supported for each model using the /v1/voices endpoint
|
|
359
|
+
sending the model name as the query parameter.
|
|
360
|
+
[View all supported voices here](https://docs.together.ai/docs/text-to-speech#voices-available).
|
|
361
|
+
|
|
362
|
+
language: Language of input text.
|
|
363
|
+
|
|
364
|
+
response_encoding: Audio encoding of response
|
|
365
|
+
|
|
366
|
+
response_format: The format of audio output. Supported formats are mp3, wav, raw if streaming is
|
|
367
|
+
false. If streaming is true, the only supported format is raw.
|
|
368
|
+
|
|
369
|
+
sample_rate: Sampling rate to use for the output audio. The default sampling rate for
|
|
370
|
+
canopylabs/orpheus-3b-0.1-ft and hexgrad/Kokoro-82M is 24000 and for
|
|
371
|
+
cartesia/sonic is 44100.
|
|
372
|
+
|
|
373
|
+
stream: If true, output is streamed for several characters at a time instead of waiting
|
|
374
|
+
for the full response. The stream terminates with `data: [DONE]`. If false,
|
|
375
|
+
return the encoded audio as octet stream
|
|
376
|
+
|
|
377
|
+
extra_headers: Send extra headers
|
|
93
378
|
|
|
94
|
-
|
|
95
|
-
def __init__(self, client: TogetherClient) -> None:
|
|
96
|
-
self._client = client
|
|
379
|
+
extra_query: Add additional query parameters to the request
|
|
97
380
|
|
|
381
|
+
extra_body: Add additional JSON properties to the request
|
|
382
|
+
|
|
383
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
384
|
+
"""
|
|
385
|
+
...
|
|
386
|
+
|
|
387
|
+
@overload
|
|
98
388
|
async def create(
|
|
99
389
|
self,
|
|
100
390
|
*,
|
|
101
|
-
model: str,
|
|
102
391
|
input: str,
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
392
|
+
model: Union[Literal["cartesia/sonic", "hexgrad/Kokoro-82M", "canopylabs/orpheus-3b-0.1-ft"], str],
|
|
393
|
+
stream: Literal[True],
|
|
394
|
+
voice: str,
|
|
395
|
+
language: Literal["en", "de", "fr", "es", "hi", "it", "ja", "ko", "nl", "pl", "pt", "ru", "sv", "tr", "zh"]
|
|
396
|
+
| Omit = omit,
|
|
397
|
+
response_encoding: Literal["pcm_f32le", "pcm_s16le", "pcm_mulaw", "pcm_alaw"] | Omit = omit,
|
|
398
|
+
response_format: Literal["mp3", "wav", "raw"] | Omit = omit,
|
|
399
|
+
sample_rate: int | Omit = omit,
|
|
400
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
401
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
402
|
+
extra_headers: Headers | None = None,
|
|
403
|
+
extra_query: Query | None = None,
|
|
404
|
+
extra_body: Body | None = None,
|
|
405
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
406
|
+
) -> AsyncStream[AudioSpeechStreamChunk]:
|
|
111
407
|
"""
|
|
112
|
-
|
|
408
|
+
Generate audio from input text
|
|
113
409
|
|
|
114
410
|
Args:
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
411
|
+
input: Input text to generate the audio for
|
|
412
|
+
|
|
413
|
+
model: The name of the model to query.
|
|
414
|
+
|
|
415
|
+
[See all of Together AI's chat models](https://docs.together.ai/docs/serverless-models#audio-models)
|
|
416
|
+
The current supported tts models are: - cartesia/sonic - hexgrad/Kokoro-82M -
|
|
417
|
+
canopylabs/orpheus-3b-0.1-ft
|
|
418
|
+
|
|
419
|
+
stream: If true, output is streamed for several characters at a time instead of waiting
|
|
420
|
+
for the full response. The stream terminates with `data: [DONE]`. If false,
|
|
421
|
+
return the encoded audio as octet stream
|
|
422
|
+
|
|
423
|
+
voice: The voice to use for generating the audio. The voices supported are different
|
|
424
|
+
for each model. For eg - for canopylabs/orpheus-3b-0.1-ft, one of the voices
|
|
425
|
+
supported is tara, for hexgrad/Kokoro-82M, one of the voices supported is
|
|
426
|
+
af_alloy and for cartesia/sonic, one of the voices supported is "friendly
|
|
427
|
+
sidekick".
|
|
428
|
+
|
|
429
|
+
You can view the voices supported for each model using the /v1/voices endpoint
|
|
430
|
+
sending the model name as the query parameter.
|
|
431
|
+
[View all supported voices here](https://docs.together.ai/docs/text-to-speech#voices-available).
|
|
432
|
+
|
|
433
|
+
language: Language of input text.
|
|
434
|
+
|
|
435
|
+
response_encoding: Audio encoding of response
|
|
436
|
+
|
|
437
|
+
response_format: The format of audio output. Supported formats are mp3, wav, raw if streaming is
|
|
438
|
+
false. If streaming is true, the only supported format is raw.
|
|
439
|
+
|
|
440
|
+
sample_rate: Sampling rate to use for the output audio. The default sampling rate for
|
|
441
|
+
canopylabs/orpheus-3b-0.1-ft and hexgrad/Kokoro-82M is 24000 and for
|
|
442
|
+
cartesia/sonic is 44100.
|
|
443
|
+
|
|
444
|
+
extra_headers: Send extra headers
|
|
445
|
+
|
|
446
|
+
extra_query: Add additional query parameters to the request
|
|
447
|
+
|
|
448
|
+
extra_body: Add additional JSON properties to the request
|
|
449
|
+
|
|
450
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
451
|
+
"""
|
|
452
|
+
...
|
|
453
|
+
|
|
454
|
+
@overload
|
|
455
|
+
async def create(
|
|
456
|
+
self,
|
|
457
|
+
*,
|
|
458
|
+
input: str,
|
|
459
|
+
model: Union[Literal["cartesia/sonic", "hexgrad/Kokoro-82M", "canopylabs/orpheus-3b-0.1-ft"], str],
|
|
460
|
+
stream: bool,
|
|
461
|
+
voice: str,
|
|
462
|
+
language: Literal["en", "de", "fr", "es", "hi", "it", "ja", "ko", "nl", "pl", "pt", "ru", "sv", "tr", "zh"]
|
|
463
|
+
| Omit = omit,
|
|
464
|
+
response_encoding: Literal["pcm_f32le", "pcm_s16le", "pcm_mulaw", "pcm_alaw"] | Omit = omit,
|
|
465
|
+
response_format: Literal["mp3", "wav", "raw"] | Omit = omit,
|
|
466
|
+
sample_rate: int | Omit = omit,
|
|
467
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
468
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
469
|
+
extra_headers: Headers | None = None,
|
|
470
|
+
extra_query: Query | None = None,
|
|
471
|
+
extra_body: Body | None = None,
|
|
472
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
473
|
+
) -> AsyncBinaryAPIResponse | AsyncStream[AudioSpeechStreamChunk]:
|
|
474
|
+
"""
|
|
475
|
+
Generate audio from input text
|
|
476
|
+
|
|
477
|
+
Args:
|
|
478
|
+
input: Input text to generate the audio for
|
|
479
|
+
|
|
480
|
+
model: The name of the model to query.
|
|
481
|
+
|
|
482
|
+
[See all of Together AI's chat models](https://docs.together.ai/docs/serverless-models#audio-models)
|
|
483
|
+
The current supported tts models are: - cartesia/sonic - hexgrad/Kokoro-82M -
|
|
484
|
+
canopylabs/orpheus-3b-0.1-ft
|
|
485
|
+
|
|
486
|
+
stream: If true, output is streamed for several characters at a time instead of waiting
|
|
487
|
+
for the full response. The stream terminates with `data: [DONE]`. If false,
|
|
488
|
+
return the encoded audio as octet stream
|
|
489
|
+
|
|
490
|
+
voice: The voice to use for generating the audio. The voices supported are different
|
|
491
|
+
for each model. For eg - for canopylabs/orpheus-3b-0.1-ft, one of the voices
|
|
492
|
+
supported is tara, for hexgrad/Kokoro-82M, one of the voices supported is
|
|
493
|
+
af_alloy and for cartesia/sonic, one of the voices supported is "friendly
|
|
494
|
+
sidekick".
|
|
495
|
+
|
|
496
|
+
You can view the voices supported for each model using the /v1/voices endpoint
|
|
497
|
+
sending the model name as the query parameter.
|
|
498
|
+
[View all supported voices here](https://docs.together.ai/docs/text-to-speech#voices-available).
|
|
499
|
+
|
|
500
|
+
language: Language of input text.
|
|
501
|
+
|
|
502
|
+
response_encoding: Audio encoding of response
|
|
503
|
+
|
|
504
|
+
response_format: The format of audio output. Supported formats are mp3, wav, raw if streaming is
|
|
505
|
+
false. If streaming is true, the only supported format is raw.
|
|
506
|
+
|
|
507
|
+
sample_rate: Sampling rate to use for the output audio. The default sampling rate for
|
|
508
|
+
canopylabs/orpheus-3b-0.1-ft and hexgrad/Kokoro-82M is 24000 and for
|
|
509
|
+
cartesia/sonic is 44100.
|
|
510
|
+
|
|
511
|
+
extra_headers: Send extra headers
|
|
512
|
+
|
|
513
|
+
extra_query: Add additional query parameters to the request
|
|
514
|
+
|
|
515
|
+
extra_body: Add additional JSON properties to the request
|
|
516
|
+
|
|
517
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
518
|
+
"""
|
|
519
|
+
...
|
|
137
520
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
521
|
+
@required_args(["input", "model", "voice"], ["input", "model", "stream", "voice"])
|
|
522
|
+
async def create(
|
|
523
|
+
self,
|
|
524
|
+
*,
|
|
525
|
+
input: str,
|
|
526
|
+
model: Union[Literal["cartesia/sonic", "hexgrad/Kokoro-82M", "canopylabs/orpheus-3b-0.1-ft"], str],
|
|
527
|
+
voice: str,
|
|
528
|
+
language: Literal["en", "de", "fr", "es", "hi", "it", "ja", "ko", "nl", "pl", "pt", "ru", "sv", "tr", "zh"]
|
|
529
|
+
| Omit = omit,
|
|
530
|
+
response_encoding: Literal["pcm_f32le", "pcm_s16le", "pcm_mulaw", "pcm_alaw"] | Omit = omit,
|
|
531
|
+
response_format: Literal["mp3", "wav", "raw"] | Omit = omit,
|
|
532
|
+
sample_rate: int | Omit = omit,
|
|
533
|
+
stream: Literal[False] | Literal[True] | Omit = omit,
|
|
534
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
535
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
536
|
+
extra_headers: Headers | None = None,
|
|
537
|
+
extra_query: Query | None = None,
|
|
538
|
+
extra_body: Body | None = None,
|
|
539
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
540
|
+
) -> AsyncBinaryAPIResponse | AsyncStream[AudioSpeechStreamChunk]:
|
|
541
|
+
extra_headers = {"Accept": "application/octet-stream", **(extra_headers or {})}
|
|
542
|
+
return await self._post(
|
|
543
|
+
"/audio/speech",
|
|
544
|
+
body=await async_maybe_transform(
|
|
545
|
+
{
|
|
546
|
+
"input": input,
|
|
547
|
+
"model": model,
|
|
548
|
+
"voice": voice,
|
|
549
|
+
"language": language,
|
|
550
|
+
"response_encoding": response_encoding,
|
|
551
|
+
"response_format": response_format,
|
|
552
|
+
"sample_rate": sample_rate,
|
|
553
|
+
"stream": stream,
|
|
554
|
+
},
|
|
555
|
+
speech_create_params.SpeechCreateParamsStreaming
|
|
556
|
+
if stream
|
|
557
|
+
else speech_create_params.SpeechCreateParamsNonStreaming,
|
|
558
|
+
),
|
|
559
|
+
options=make_request_options(
|
|
560
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
155
561
|
),
|
|
156
|
-
|
|
562
|
+
cast_to=AsyncBinaryAPIResponse,
|
|
563
|
+
stream=stream or False,
|
|
564
|
+
stream_cls=AsyncStream[AudioSpeechStreamChunk],
|
|
565
|
+
)
|
|
566
|
+
|
|
567
|
+
|
|
568
|
+
class SpeechResourceWithRawResponse:
|
|
569
|
+
def __init__(self, speech: SpeechResource) -> None:
|
|
570
|
+
self._speech = speech
|
|
571
|
+
|
|
572
|
+
self.create = to_custom_raw_response_wrapper(
|
|
573
|
+
speech.create,
|
|
574
|
+
BinaryAPIResponse,
|
|
575
|
+
)
|
|
576
|
+
|
|
577
|
+
|
|
578
|
+
class AsyncSpeechResourceWithRawResponse:
|
|
579
|
+
def __init__(self, speech: AsyncSpeechResource) -> None:
|
|
580
|
+
self._speech = speech
|
|
581
|
+
|
|
582
|
+
self.create = async_to_custom_raw_response_wrapper(
|
|
583
|
+
speech.create,
|
|
584
|
+
AsyncBinaryAPIResponse,
|
|
585
|
+
)
|
|
586
|
+
|
|
587
|
+
|
|
588
|
+
class SpeechResourceWithStreamingResponse:
|
|
589
|
+
def __init__(self, speech: SpeechResource) -> None:
|
|
590
|
+
self._speech = speech
|
|
591
|
+
|
|
592
|
+
self.create = to_custom_streamed_response_wrapper(
|
|
593
|
+
speech.create,
|
|
594
|
+
StreamedBinaryAPIResponse,
|
|
157
595
|
)
|
|
158
596
|
|
|
159
|
-
|
|
597
|
+
|
|
598
|
+
class AsyncSpeechResourceWithStreamingResponse:
|
|
599
|
+
def __init__(self, speech: AsyncSpeechResource) -> None:
|
|
600
|
+
self._speech = speech
|
|
601
|
+
|
|
602
|
+
self.create = async_to_custom_streamed_response_wrapper(
|
|
603
|
+
speech.create,
|
|
604
|
+
AsyncStreamedBinaryAPIResponse,
|
|
605
|
+
)
|