together 1.5.17__py3-none-any.whl → 2.0.0a8__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 -63
- 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 +108 -75
- together/lib/cli/api/evals.py +588 -0
- together/{cli → lib/cli}/api/files.py +20 -17
- together/{cli/api/finetune.py → lib/cli/api/fine_tuning.py} +161 -120
- together/lib/cli/api/models.py +140 -0
- together/{cli → lib/cli}/api/utils.py +6 -7
- together/{cli → lib/cli}/cli.py +16 -24
- together/{constants.py → lib/constants.py} +17 -12
- 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 +455 -0
- together/{utils → lib/utils}/__init__.py +6 -14
- together/{utils → lib/utils}/_log.py +11 -16
- together/lib/utils/files.py +628 -0
- together/lib/utils/serializer.py +10 -0
- together/{utils → lib/utils}/tools.py +19 -55
- together/resources/__init__.py +225 -33
- together/resources/audio/__init__.py +72 -21
- together/resources/audio/audio.py +198 -0
- together/resources/audio/speech.py +574 -122
- together/resources/audio/transcriptions.py +282 -0
- together/resources/audio/translations.py +256 -0
- together/resources/audio/voices.py +135 -0
- 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 +598 -395
- together/resources/evals.py +452 -0
- together/resources/files.py +398 -121
- together/resources/fine_tuning.py +1033 -0
- together/resources/hardware.py +181 -0
- together/resources/images.py +256 -108
- together/resources/jobs.py +214 -0
- together/resources/models.py +238 -90
- together/resources/rerank.py +190 -92
- together/resources/videos.py +374 -0
- together/types/__init__.py +65 -109
- 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_job.py +57 -0
- together-2.0.0a8.dist-info/METADATA +680 -0
- together-2.0.0a8.dist-info/RECORD +164 -0
- {together-1.5.17.dist-info → together-2.0.0a8.dist-info}/WHEEL +1 -1
- together-2.0.0a8.dist-info/entry_points.txt +2 -0
- {together-1.5.17.dist-info → together-2.0.0a8.dist-info/licenses}/LICENSE +1 -1
- together/abstract/api_requestor.py +0 -729
- together/cli/api/chat.py +0 -276
- together/cli/api/completions.py +0 -119
- together/cli/api/images.py +0 -93
- together/cli/api/models.py +0 -55
- together/client.py +0 -176
- together/error.py +0 -194
- together/filemanager.py +0 -389
- 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 -136
- together/resources/code_interpreter.py +0 -82
- together/resources/finetune.py +0 -1064
- together/together_response.py +0 -50
- together/types/abstract.py +0 -26
- together/types/audio_speech.py +0 -110
- together/types/batch.py +0 -53
- together/types/chat_completions.py +0 -197
- together/types/code_interpreter.py +0 -57
- together/types/common.py +0 -66
- 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/files.py +0 -90
- together/types/finetune.py +0 -398
- together/types/images.py +0 -44
- together/types/models.py +0 -45
- together/types/rerank.py +0 -43
- together/utils/api_helpers.py +0 -124
- together/utils/files.py +0 -425
- together/version.py +0 -6
- together-1.5.17.dist-info/METADATA +0 -525
- together-1.5.17.dist-info/RECORD +0 -69
- together-1.5.17.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
|
@@ -0,0 +1,374 @@
|
|
|
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 Iterable
|
|
6
|
+
from typing_extensions import Literal
|
|
7
|
+
|
|
8
|
+
import httpx
|
|
9
|
+
|
|
10
|
+
from ..types import video_create_params
|
|
11
|
+
from .._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given
|
|
12
|
+
from .._utils import maybe_transform, async_maybe_transform
|
|
13
|
+
from .._compat import cached_property
|
|
14
|
+
from .._resource import SyncAPIResource, AsyncAPIResource
|
|
15
|
+
from .._response import (
|
|
16
|
+
to_raw_response_wrapper,
|
|
17
|
+
to_streamed_response_wrapper,
|
|
18
|
+
async_to_raw_response_wrapper,
|
|
19
|
+
async_to_streamed_response_wrapper,
|
|
20
|
+
)
|
|
21
|
+
from .._base_client import make_request_options
|
|
22
|
+
from ..types.video_job import VideoJob
|
|
23
|
+
|
|
24
|
+
__all__ = ["VideosResource", "AsyncVideosResource"]
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class VideosResource(SyncAPIResource):
|
|
28
|
+
@cached_property
|
|
29
|
+
def with_raw_response(self) -> VideosResourceWithRawResponse:
|
|
30
|
+
"""
|
|
31
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
32
|
+
the raw response object instead of the parsed content.
|
|
33
|
+
|
|
34
|
+
For more information, see https://www.github.com/togethercomputer/together-py#accessing-raw-response-data-eg-headers
|
|
35
|
+
"""
|
|
36
|
+
return VideosResourceWithRawResponse(self)
|
|
37
|
+
|
|
38
|
+
@cached_property
|
|
39
|
+
def with_streaming_response(self) -> VideosResourceWithStreamingResponse:
|
|
40
|
+
"""
|
|
41
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
42
|
+
|
|
43
|
+
For more information, see https://www.github.com/togethercomputer/together-py#with_streaming_response
|
|
44
|
+
"""
|
|
45
|
+
return VideosResourceWithStreamingResponse(self)
|
|
46
|
+
|
|
47
|
+
def create(
|
|
48
|
+
self,
|
|
49
|
+
*,
|
|
50
|
+
model: str,
|
|
51
|
+
fps: int | Omit = omit,
|
|
52
|
+
frame_images: Iterable[video_create_params.FrameImage] | Omit = omit,
|
|
53
|
+
guidance_scale: int | Omit = omit,
|
|
54
|
+
height: int | Omit = omit,
|
|
55
|
+
negative_prompt: str | Omit = omit,
|
|
56
|
+
output_format: Literal["MP4", "WEBM"] | Omit = omit,
|
|
57
|
+
output_quality: int | Omit = omit,
|
|
58
|
+
prompt: str | Omit = omit,
|
|
59
|
+
reference_images: SequenceNotStr[str] | Omit = omit,
|
|
60
|
+
seconds: str | Omit = omit,
|
|
61
|
+
seed: int | Omit = omit,
|
|
62
|
+
steps: int | Omit = omit,
|
|
63
|
+
width: int | Omit = omit,
|
|
64
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
65
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
66
|
+
extra_headers: Headers | None = None,
|
|
67
|
+
extra_query: Query | None = None,
|
|
68
|
+
extra_body: Body | None = None,
|
|
69
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
70
|
+
) -> VideoJob:
|
|
71
|
+
"""
|
|
72
|
+
Create a video
|
|
73
|
+
|
|
74
|
+
Args:
|
|
75
|
+
model: The model to be used for the video creation request.
|
|
76
|
+
|
|
77
|
+
fps: Frames per second. Defaults to 24.
|
|
78
|
+
|
|
79
|
+
frame_images: Array of images to guide video generation, similar to keyframes.
|
|
80
|
+
|
|
81
|
+
guidance_scale: Controls how closely the video generation follows your prompt. Higher values
|
|
82
|
+
make the model adhere more strictly to your text description, while lower values
|
|
83
|
+
allow more creative freedom. guidence_scale affects both visual content and
|
|
84
|
+
temporal consistency.Recommended range is 6.0-10.0 for most video models. Values
|
|
85
|
+
above 12 may cause over-guidance artifacts or unnatural motion patterns.
|
|
86
|
+
|
|
87
|
+
negative_prompt: Similar to prompt, but specifies what to avoid instead of what to include
|
|
88
|
+
|
|
89
|
+
output_format: Specifies the format of the output video. Defaults to MP4.
|
|
90
|
+
|
|
91
|
+
output_quality: Compression quality. Defaults to 20.
|
|
92
|
+
|
|
93
|
+
prompt: Text prompt that describes the video to generate.
|
|
94
|
+
|
|
95
|
+
reference_images: Unlike frame_images which constrain specific timeline positions, reference
|
|
96
|
+
images guide the general appearance that should appear consistently across the
|
|
97
|
+
video.
|
|
98
|
+
|
|
99
|
+
seconds: Clip duration in seconds.
|
|
100
|
+
|
|
101
|
+
seed: Seed to use in initializing the video generation. Using the same seed allows
|
|
102
|
+
deterministic video generation. If not provided a random seed is generated for
|
|
103
|
+
each request.
|
|
104
|
+
|
|
105
|
+
steps: The number of denoising steps the model performs during video generation. More
|
|
106
|
+
steps typically result in higher quality output but require longer processing
|
|
107
|
+
time.
|
|
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
|
+
return self._post(
|
|
118
|
+
"/videos" if self._client._base_url_overridden else "https://api.together.xyz/v2/videos",
|
|
119
|
+
body=maybe_transform(
|
|
120
|
+
{
|
|
121
|
+
"model": model,
|
|
122
|
+
"fps": fps,
|
|
123
|
+
"frame_images": frame_images,
|
|
124
|
+
"guidance_scale": guidance_scale,
|
|
125
|
+
"height": height,
|
|
126
|
+
"negative_prompt": negative_prompt,
|
|
127
|
+
"output_format": output_format,
|
|
128
|
+
"output_quality": output_quality,
|
|
129
|
+
"prompt": prompt,
|
|
130
|
+
"reference_images": reference_images,
|
|
131
|
+
"seconds": seconds,
|
|
132
|
+
"seed": seed,
|
|
133
|
+
"steps": steps,
|
|
134
|
+
"width": width,
|
|
135
|
+
},
|
|
136
|
+
video_create_params.VideoCreateParams,
|
|
137
|
+
),
|
|
138
|
+
options=make_request_options(
|
|
139
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
140
|
+
),
|
|
141
|
+
cast_to=VideoJob,
|
|
142
|
+
)
|
|
143
|
+
|
|
144
|
+
def retrieve(
|
|
145
|
+
self,
|
|
146
|
+
id: str,
|
|
147
|
+
*,
|
|
148
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
149
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
150
|
+
extra_headers: Headers | None = None,
|
|
151
|
+
extra_query: Query | None = None,
|
|
152
|
+
extra_body: Body | None = None,
|
|
153
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
154
|
+
) -> VideoJob:
|
|
155
|
+
"""
|
|
156
|
+
Fetch video metadata
|
|
157
|
+
|
|
158
|
+
Args:
|
|
159
|
+
extra_headers: Send extra headers
|
|
160
|
+
|
|
161
|
+
extra_query: Add additional query parameters to the request
|
|
162
|
+
|
|
163
|
+
extra_body: Add additional JSON properties to the request
|
|
164
|
+
|
|
165
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
166
|
+
"""
|
|
167
|
+
if not id:
|
|
168
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
169
|
+
return self._get(
|
|
170
|
+
f"/videos/{id}" if self._client._base_url_overridden else f"https://api.together.xyz/v2/videos/{id}",
|
|
171
|
+
options=make_request_options(
|
|
172
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
173
|
+
),
|
|
174
|
+
cast_to=VideoJob,
|
|
175
|
+
)
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
class AsyncVideosResource(AsyncAPIResource):
|
|
179
|
+
@cached_property
|
|
180
|
+
def with_raw_response(self) -> AsyncVideosResourceWithRawResponse:
|
|
181
|
+
"""
|
|
182
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
183
|
+
the raw response object instead of the parsed content.
|
|
184
|
+
|
|
185
|
+
For more information, see https://www.github.com/togethercomputer/together-py#accessing-raw-response-data-eg-headers
|
|
186
|
+
"""
|
|
187
|
+
return AsyncVideosResourceWithRawResponse(self)
|
|
188
|
+
|
|
189
|
+
@cached_property
|
|
190
|
+
def with_streaming_response(self) -> AsyncVideosResourceWithStreamingResponse:
|
|
191
|
+
"""
|
|
192
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
193
|
+
|
|
194
|
+
For more information, see https://www.github.com/togethercomputer/together-py#with_streaming_response
|
|
195
|
+
"""
|
|
196
|
+
return AsyncVideosResourceWithStreamingResponse(self)
|
|
197
|
+
|
|
198
|
+
async def create(
|
|
199
|
+
self,
|
|
200
|
+
*,
|
|
201
|
+
model: str,
|
|
202
|
+
fps: int | Omit = omit,
|
|
203
|
+
frame_images: Iterable[video_create_params.FrameImage] | Omit = omit,
|
|
204
|
+
guidance_scale: int | Omit = omit,
|
|
205
|
+
height: int | Omit = omit,
|
|
206
|
+
negative_prompt: str | Omit = omit,
|
|
207
|
+
output_format: Literal["MP4", "WEBM"] | Omit = omit,
|
|
208
|
+
output_quality: int | Omit = omit,
|
|
209
|
+
prompt: str | Omit = omit,
|
|
210
|
+
reference_images: SequenceNotStr[str] | Omit = omit,
|
|
211
|
+
seconds: str | Omit = omit,
|
|
212
|
+
seed: int | Omit = omit,
|
|
213
|
+
steps: int | Omit = omit,
|
|
214
|
+
width: int | Omit = omit,
|
|
215
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
216
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
217
|
+
extra_headers: Headers | None = None,
|
|
218
|
+
extra_query: Query | None = None,
|
|
219
|
+
extra_body: Body | None = None,
|
|
220
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
221
|
+
) -> VideoJob:
|
|
222
|
+
"""
|
|
223
|
+
Create a video
|
|
224
|
+
|
|
225
|
+
Args:
|
|
226
|
+
model: The model to be used for the video creation request.
|
|
227
|
+
|
|
228
|
+
fps: Frames per second. Defaults to 24.
|
|
229
|
+
|
|
230
|
+
frame_images: Array of images to guide video generation, similar to keyframes.
|
|
231
|
+
|
|
232
|
+
guidance_scale: Controls how closely the video generation follows your prompt. Higher values
|
|
233
|
+
make the model adhere more strictly to your text description, while lower values
|
|
234
|
+
allow more creative freedom. guidence_scale affects both visual content and
|
|
235
|
+
temporal consistency.Recommended range is 6.0-10.0 for most video models. Values
|
|
236
|
+
above 12 may cause over-guidance artifacts or unnatural motion patterns.
|
|
237
|
+
|
|
238
|
+
negative_prompt: Similar to prompt, but specifies what to avoid instead of what to include
|
|
239
|
+
|
|
240
|
+
output_format: Specifies the format of the output video. Defaults to MP4.
|
|
241
|
+
|
|
242
|
+
output_quality: Compression quality. Defaults to 20.
|
|
243
|
+
|
|
244
|
+
prompt: Text prompt that describes the video to generate.
|
|
245
|
+
|
|
246
|
+
reference_images: Unlike frame_images which constrain specific timeline positions, reference
|
|
247
|
+
images guide the general appearance that should appear consistently across the
|
|
248
|
+
video.
|
|
249
|
+
|
|
250
|
+
seconds: Clip duration in seconds.
|
|
251
|
+
|
|
252
|
+
seed: Seed to use in initializing the video generation. Using the same seed allows
|
|
253
|
+
deterministic video generation. If not provided a random seed is generated for
|
|
254
|
+
each request.
|
|
255
|
+
|
|
256
|
+
steps: The number of denoising steps the model performs during video generation. More
|
|
257
|
+
steps typically result in higher quality output but require longer processing
|
|
258
|
+
time.
|
|
259
|
+
|
|
260
|
+
extra_headers: Send extra headers
|
|
261
|
+
|
|
262
|
+
extra_query: Add additional query parameters to the request
|
|
263
|
+
|
|
264
|
+
extra_body: Add additional JSON properties to the request
|
|
265
|
+
|
|
266
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
267
|
+
"""
|
|
268
|
+
return await self._post(
|
|
269
|
+
"/videos" if self._client._base_url_overridden else "https://api.together.xyz/v2/videos",
|
|
270
|
+
body=await async_maybe_transform(
|
|
271
|
+
{
|
|
272
|
+
"model": model,
|
|
273
|
+
"fps": fps,
|
|
274
|
+
"frame_images": frame_images,
|
|
275
|
+
"guidance_scale": guidance_scale,
|
|
276
|
+
"height": height,
|
|
277
|
+
"negative_prompt": negative_prompt,
|
|
278
|
+
"output_format": output_format,
|
|
279
|
+
"output_quality": output_quality,
|
|
280
|
+
"prompt": prompt,
|
|
281
|
+
"reference_images": reference_images,
|
|
282
|
+
"seconds": seconds,
|
|
283
|
+
"seed": seed,
|
|
284
|
+
"steps": steps,
|
|
285
|
+
"width": width,
|
|
286
|
+
},
|
|
287
|
+
video_create_params.VideoCreateParams,
|
|
288
|
+
),
|
|
289
|
+
options=make_request_options(
|
|
290
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
291
|
+
),
|
|
292
|
+
cast_to=VideoJob,
|
|
293
|
+
)
|
|
294
|
+
|
|
295
|
+
async def retrieve(
|
|
296
|
+
self,
|
|
297
|
+
id: str,
|
|
298
|
+
*,
|
|
299
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
300
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
301
|
+
extra_headers: Headers | None = None,
|
|
302
|
+
extra_query: Query | None = None,
|
|
303
|
+
extra_body: Body | None = None,
|
|
304
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
305
|
+
) -> VideoJob:
|
|
306
|
+
"""
|
|
307
|
+
Fetch video metadata
|
|
308
|
+
|
|
309
|
+
Args:
|
|
310
|
+
extra_headers: Send extra headers
|
|
311
|
+
|
|
312
|
+
extra_query: Add additional query parameters to the request
|
|
313
|
+
|
|
314
|
+
extra_body: Add additional JSON properties to the request
|
|
315
|
+
|
|
316
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
317
|
+
"""
|
|
318
|
+
if not id:
|
|
319
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
320
|
+
return await self._get(
|
|
321
|
+
f"/videos/{id}" if self._client._base_url_overridden else f"https://api.together.xyz/v2/videos/{id}",
|
|
322
|
+
options=make_request_options(
|
|
323
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
324
|
+
),
|
|
325
|
+
cast_to=VideoJob,
|
|
326
|
+
)
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
class VideosResourceWithRawResponse:
|
|
330
|
+
def __init__(self, videos: VideosResource) -> None:
|
|
331
|
+
self._videos = videos
|
|
332
|
+
|
|
333
|
+
self.create = to_raw_response_wrapper(
|
|
334
|
+
videos.create,
|
|
335
|
+
)
|
|
336
|
+
self.retrieve = to_raw_response_wrapper(
|
|
337
|
+
videos.retrieve,
|
|
338
|
+
)
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
class AsyncVideosResourceWithRawResponse:
|
|
342
|
+
def __init__(self, videos: AsyncVideosResource) -> None:
|
|
343
|
+
self._videos = videos
|
|
344
|
+
|
|
345
|
+
self.create = async_to_raw_response_wrapper(
|
|
346
|
+
videos.create,
|
|
347
|
+
)
|
|
348
|
+
self.retrieve = async_to_raw_response_wrapper(
|
|
349
|
+
videos.retrieve,
|
|
350
|
+
)
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
class VideosResourceWithStreamingResponse:
|
|
354
|
+
def __init__(self, videos: VideosResource) -> None:
|
|
355
|
+
self._videos = videos
|
|
356
|
+
|
|
357
|
+
self.create = to_streamed_response_wrapper(
|
|
358
|
+
videos.create,
|
|
359
|
+
)
|
|
360
|
+
self.retrieve = to_streamed_response_wrapper(
|
|
361
|
+
videos.retrieve,
|
|
362
|
+
)
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
class AsyncVideosResourceWithStreamingResponse:
|
|
366
|
+
def __init__(self, videos: AsyncVideosResource) -> None:
|
|
367
|
+
self._videos = videos
|
|
368
|
+
|
|
369
|
+
self.create = async_to_streamed_response_wrapper(
|
|
370
|
+
videos.create,
|
|
371
|
+
)
|
|
372
|
+
self.retrieve = async_to_streamed_response_wrapper(
|
|
373
|
+
videos.retrieve,
|
|
374
|
+
)
|
together/types/__init__.py
CHANGED
|
@@ -1,111 +1,67 @@
|
|
|
1
|
-
from
|
|
2
|
-
from together.types.audio_speech import (
|
|
3
|
-
AudioLanguage,
|
|
4
|
-
AudioResponseEncoding,
|
|
5
|
-
AudioResponseFormat,
|
|
6
|
-
AudioSpeechRequest,
|
|
7
|
-
AudioSpeechStreamChunk,
|
|
8
|
-
AudioSpeechStreamEvent,
|
|
9
|
-
AudioSpeechStreamResponse,
|
|
10
|
-
)
|
|
11
|
-
from together.types.chat_completions import (
|
|
12
|
-
ChatCompletionChunk,
|
|
13
|
-
ChatCompletionRequest,
|
|
14
|
-
ChatCompletionResponse,
|
|
15
|
-
)
|
|
16
|
-
from together.types.common import TogetherRequest
|
|
17
|
-
from together.types.completions import (
|
|
18
|
-
CompletionChunk,
|
|
19
|
-
CompletionRequest,
|
|
20
|
-
CompletionResponse,
|
|
21
|
-
)
|
|
22
|
-
from together.types.embeddings import EmbeddingRequest, EmbeddingResponse
|
|
23
|
-
from together.types.endpoints import Autoscaling, DedicatedEndpoint, ListEndpoint
|
|
24
|
-
from together.types.files import (
|
|
25
|
-
FileDeleteResponse,
|
|
26
|
-
FileList,
|
|
27
|
-
FileObject,
|
|
28
|
-
FilePurpose,
|
|
29
|
-
FileRequest,
|
|
30
|
-
FileResponse,
|
|
31
|
-
FileType,
|
|
32
|
-
)
|
|
33
|
-
from together.types.finetune import (
|
|
34
|
-
TrainingMethodDPO,
|
|
35
|
-
TrainingMethodSFT,
|
|
36
|
-
FinetuneCheckpoint,
|
|
37
|
-
CosineLRScheduler,
|
|
38
|
-
CosineLRSchedulerArgs,
|
|
39
|
-
FinetuneDownloadResult,
|
|
40
|
-
LinearLRScheduler,
|
|
41
|
-
LinearLRSchedulerArgs,
|
|
42
|
-
FinetuneLRScheduler,
|
|
43
|
-
FinetuneList,
|
|
44
|
-
FinetuneListEvents,
|
|
45
|
-
FinetuneRequest,
|
|
46
|
-
FinetuneResponse,
|
|
47
|
-
FinetuneTrainingLimits,
|
|
48
|
-
FullTrainingType,
|
|
49
|
-
LoRATrainingType,
|
|
50
|
-
TrainingType,
|
|
51
|
-
)
|
|
52
|
-
from together.types.images import ImageRequest, ImageResponse
|
|
53
|
-
from together.types.models import ModelObject
|
|
54
|
-
from together.types.rerank import RerankRequest, RerankResponse
|
|
55
|
-
from together.types.batch import BatchJob, BatchJobStatus, BatchEndpoint
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
56
2
|
|
|
3
|
+
from __future__ import annotations
|
|
57
4
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
5
|
+
from .batch_job import BatchJob as BatchJob
|
|
6
|
+
from .embedding import Embedding as Embedding
|
|
7
|
+
from .file_list import FileList as FileList
|
|
8
|
+
from .file_type import FileType as FileType
|
|
9
|
+
from .log_probs import LogProbs as LogProbs
|
|
10
|
+
from .video_job import VideoJob as VideoJob
|
|
11
|
+
from .completion import Completion as Completion
|
|
12
|
+
from .image_file import ImageFile as ImageFile
|
|
13
|
+
from .autoscaling import Autoscaling as Autoscaling
|
|
14
|
+
from .tool_choice import ToolChoice as ToolChoice
|
|
15
|
+
from .tools_param import ToolsParam as ToolsParam
|
|
16
|
+
from .file_purpose import FilePurpose as FilePurpose
|
|
17
|
+
from .model_object import ModelObject as ModelObject
|
|
18
|
+
from .file_response import FileResponse as FileResponse
|
|
19
|
+
from .evaluation_job import EvaluationJob as EvaluationJob
|
|
20
|
+
from .finetune_event import FinetuneEvent as FinetuneEvent
|
|
21
|
+
from .image_data_b64 import ImageDataB64 as ImageDataB64
|
|
22
|
+
from .image_data_url import ImageDataURL as ImageDataURL
|
|
23
|
+
from .completion_chunk import CompletionChunk as CompletionChunk
|
|
24
|
+
from .eval_list_params import EvalListParams as EvalListParams
|
|
25
|
+
from .execute_response import ExecuteResponse as ExecuteResponse
|
|
26
|
+
from .autoscaling_param import AutoscalingParam as AutoscalingParam
|
|
27
|
+
from .finetune_response import FinetuneResponse as FinetuneResponse
|
|
28
|
+
from .job_list_response import JobListResponse as JobListResponse
|
|
29
|
+
from .tool_choice_param import ToolChoiceParam as ToolChoiceParam
|
|
30
|
+
from .dedicated_endpoint import DedicatedEndpoint as DedicatedEndpoint
|
|
31
|
+
from .eval_create_params import EvalCreateParams as EvalCreateParams
|
|
32
|
+
from .eval_list_response import EvalListResponse as EvalListResponse
|
|
33
|
+
from .batch_create_params import BatchCreateParams as BatchCreateParams
|
|
34
|
+
from .batch_list_response import BatchListResponse as BatchListResponse
|
|
35
|
+
from .finetune_event_type import FinetuneEventType as FinetuneEventType
|
|
36
|
+
from .model_list_response import ModelListResponse as ModelListResponse
|
|
37
|
+
from .model_upload_params import ModelUploadParams as ModelUploadParams
|
|
38
|
+
from .video_create_params import VideoCreateParams as VideoCreateParams
|
|
39
|
+
from .endpoint_list_params import EndpointListParams as EndpointListParams
|
|
40
|
+
from .eval_create_response import EvalCreateResponse as EvalCreateResponse
|
|
41
|
+
from .eval_status_response import EvalStatusResponse as EvalStatusResponse
|
|
42
|
+
from .file_delete_response import FileDeleteResponse as FileDeleteResponse
|
|
43
|
+
from .hardware_list_params import HardwareListParams as HardwareListParams
|
|
44
|
+
from .rerank_create_params import RerankCreateParams as RerankCreateParams
|
|
45
|
+
from .batch_create_response import BatchCreateResponse as BatchCreateResponse
|
|
46
|
+
from .image_generate_params import ImageGenerateParams as ImageGenerateParams
|
|
47
|
+
from .job_retrieve_response import JobRetrieveResponse as JobRetrieveResponse
|
|
48
|
+
from .model_upload_response import ModelUploadResponse as ModelUploadResponse
|
|
49
|
+
from .endpoint_create_params import EndpointCreateParams as EndpointCreateParams
|
|
50
|
+
from .endpoint_list_response import EndpointListResponse as EndpointListResponse
|
|
51
|
+
from .endpoint_update_params import EndpointUpdateParams as EndpointUpdateParams
|
|
52
|
+
from .hardware_list_response import HardwareListResponse as HardwareListResponse
|
|
53
|
+
from .rerank_create_response import RerankCreateResponse as RerankCreateResponse
|
|
54
|
+
from .embedding_create_params import EmbeddingCreateParams as EmbeddingCreateParams
|
|
55
|
+
from .completion_create_params import CompletionCreateParams as CompletionCreateParams
|
|
56
|
+
from .audio_speech_stream_chunk import AudioSpeechStreamChunk as AudioSpeechStreamChunk
|
|
57
|
+
from .fine_tuning_delete_params import FineTuningDeleteParams as FineTuningDeleteParams
|
|
58
|
+
from .fine_tuning_list_response import FineTuningListResponse as FineTuningListResponse
|
|
59
|
+
from .fine_tuning_content_params import FineTuningContentParams as FineTuningContentParams
|
|
60
|
+
from .fine_tuning_cancel_response import FineTuningCancelResponse as FineTuningCancelResponse
|
|
61
|
+
from .fine_tuning_delete_response import FineTuningDeleteResponse as FineTuningDeleteResponse
|
|
62
|
+
from .endpoint_list_avzones_response import EndpointListAvzonesResponse as EndpointListAvzonesResponse
|
|
63
|
+
from .code_interpreter_execute_params import CodeInterpreterExecuteParams as CodeInterpreterExecuteParams
|
|
64
|
+
from .fine_tuning_list_events_response import FineTuningListEventsResponse as FineTuningListEventsResponse
|
|
65
|
+
from .fine_tuning_list_checkpoints_response import (
|
|
66
|
+
FineTuningListCheckpointsResponse as FineTuningListCheckpointsResponse,
|
|
67
|
+
)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from .voice_list_response import VoiceListResponse as VoiceListResponse
|
|
6
|
+
from .speech_create_params import SpeechCreateParams as SpeechCreateParams
|
|
7
|
+
from .translation_create_params import TranslationCreateParams as TranslationCreateParams
|
|
8
|
+
from .transcription_create_params import TranscriptionCreateParams as TranscriptionCreateParams
|
|
9
|
+
from .translation_create_response import TranslationCreateResponse as TranslationCreateResponse
|
|
10
|
+
from .transcription_create_response import TranscriptionCreateResponse as TranscriptionCreateResponse
|
|
@@ -0,0 +1,75 @@
|
|
|
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 Union
|
|
6
|
+
from typing_extensions import Literal, Required, TypedDict
|
|
7
|
+
|
|
8
|
+
__all__ = ["SpeechCreateParamsBase", "SpeechCreateParamsNonStreaming", "SpeechCreateParamsStreaming"]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class SpeechCreateParamsBase(TypedDict, total=False):
|
|
12
|
+
input: Required[str]
|
|
13
|
+
"""Input text to generate the audio for"""
|
|
14
|
+
|
|
15
|
+
model: Required[Union[Literal["cartesia/sonic", "hexgrad/Kokoro-82M", "canopylabs/orpheus-3b-0.1-ft"], str]]
|
|
16
|
+
"""The name of the model to query.
|
|
17
|
+
|
|
18
|
+
[See all of Together AI's chat models](https://docs.together.ai/docs/serverless-models#audio-models)
|
|
19
|
+
The current supported tts models are: - cartesia/sonic - hexgrad/Kokoro-82M -
|
|
20
|
+
canopylabs/orpheus-3b-0.1-ft
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
voice: Required[str]
|
|
24
|
+
"""The voice to use for generating the audio.
|
|
25
|
+
|
|
26
|
+
The voices supported are different for each model. For eg - for
|
|
27
|
+
canopylabs/orpheus-3b-0.1-ft, one of the voices supported is tara, for
|
|
28
|
+
hexgrad/Kokoro-82M, one of the voices supported is af_alloy and for
|
|
29
|
+
cartesia/sonic, one of the voices supported is "friendly sidekick".
|
|
30
|
+
|
|
31
|
+
You can view the voices supported for each model using the /v1/voices endpoint
|
|
32
|
+
sending the model name as the query parameter.
|
|
33
|
+
[View all supported voices here](https://docs.together.ai/docs/text-to-speech#voices-available).
|
|
34
|
+
"""
|
|
35
|
+
|
|
36
|
+
language: Literal["en", "de", "fr", "es", "hi", "it", "ja", "ko", "nl", "pl", "pt", "ru", "sv", "tr", "zh"]
|
|
37
|
+
"""Language of input text."""
|
|
38
|
+
|
|
39
|
+
response_encoding: Literal["pcm_f32le", "pcm_s16le", "pcm_mulaw", "pcm_alaw"]
|
|
40
|
+
"""Audio encoding of response"""
|
|
41
|
+
|
|
42
|
+
response_format: Literal["mp3", "wav", "raw"]
|
|
43
|
+
"""The format of audio output.
|
|
44
|
+
|
|
45
|
+
Supported formats are mp3, wav, raw if streaming is false. If streaming is true,
|
|
46
|
+
the only supported format is raw.
|
|
47
|
+
"""
|
|
48
|
+
|
|
49
|
+
sample_rate: int
|
|
50
|
+
"""Sampling rate to use for the output audio.
|
|
51
|
+
|
|
52
|
+
The default sampling rate for canopylabs/orpheus-3b-0.1-ft and
|
|
53
|
+
hexgrad/Kokoro-82M is 24000 and for cartesia/sonic is 44100.
|
|
54
|
+
"""
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
class SpeechCreateParamsNonStreaming(SpeechCreateParamsBase, total=False):
|
|
58
|
+
stream: Literal[False]
|
|
59
|
+
"""
|
|
60
|
+
If true, output is streamed for several characters at a time instead of waiting
|
|
61
|
+
for the full response. The stream terminates with `data: [DONE]`. If false,
|
|
62
|
+
return the encoded audio as octet stream
|
|
63
|
+
"""
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
class SpeechCreateParamsStreaming(SpeechCreateParamsBase):
|
|
67
|
+
stream: Required[Literal[True]]
|
|
68
|
+
"""
|
|
69
|
+
If true, output is streamed for several characters at a time instead of waiting
|
|
70
|
+
for the full response. The stream terminates with `data: [DONE]`. If false,
|
|
71
|
+
return the encoded audio as octet stream
|
|
72
|
+
"""
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
SpeechCreateParams = Union[SpeechCreateParamsNonStreaming, SpeechCreateParamsStreaming]
|