together 2.0.0a7__py3-none-any.whl → 2.0.0a9__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/_streaming.py CHANGED
@@ -55,30 +55,31 @@ class Stream(Generic[_T]):
55
55
  process_data = self._client._process_response_data
56
56
  iterator = self._iter_events()
57
57
 
58
- for sse in iterator:
59
- if sse.data.startswith("[DONE]"):
60
- break
61
-
62
- if sse.event is None:
63
- data = sse.json()
64
- if is_mapping(data) and data.get("error"):
65
- message = None
66
- error = data.get("error")
67
- if is_mapping(error):
68
- message = error.get("message")
69
- if not message or not isinstance(message, str):
70
- message = "An error occurred during streaming"
71
-
72
- raise APIError(
73
- message=message,
74
- request=self.response.request,
75
- body=data["error"],
76
- )
77
-
78
- yield process_data(data=data, cast_to=cast_to, response=response)
79
-
80
- # As we might not fully consume the response stream, we need to close it explicitly
81
- response.close()
58
+ try:
59
+ for sse in iterator:
60
+ if sse.data.startswith("[DONE]"):
61
+ break
62
+
63
+ if sse.event is None:
64
+ data = sse.json()
65
+ if is_mapping(data) and data.get("error"):
66
+ message = None
67
+ error = data.get("error")
68
+ if is_mapping(error):
69
+ message = error.get("message")
70
+ if not message or not isinstance(message, str):
71
+ message = "An error occurred during streaming"
72
+
73
+ raise APIError(
74
+ message=message,
75
+ request=self.response.request,
76
+ body=data["error"],
77
+ )
78
+
79
+ yield process_data(data=data, cast_to=cast_to, response=response)
80
+ finally:
81
+ # Ensure the response is closed even if the consumer doesn't read all data
82
+ response.close()
82
83
 
83
84
  def __enter__(self) -> Self:
84
85
  return self
@@ -137,30 +138,31 @@ class AsyncStream(Generic[_T]):
137
138
  process_data = self._client._process_response_data
138
139
  iterator = self._iter_events()
139
140
 
140
- async for sse in iterator:
141
- if sse.data.startswith("[DONE]"):
142
- break
143
-
144
- if sse.event is None:
145
- data = sse.json()
146
- if is_mapping(data) and data.get("error"):
147
- message = None
148
- error = data.get("error")
149
- if is_mapping(error):
150
- message = error.get("message")
151
- if not message or not isinstance(message, str):
152
- message = "An error occurred during streaming"
153
-
154
- raise APIError(
155
- message=message,
156
- request=self.response.request,
157
- body=data["error"],
158
- )
159
-
160
- yield process_data(data=data, cast_to=cast_to, response=response)
161
-
162
- # As we might not fully consume the response stream, we need to close it explicitly
163
- await response.aclose()
141
+ try:
142
+ async for sse in iterator:
143
+ if sse.data.startswith("[DONE]"):
144
+ break
145
+
146
+ if sse.event is None:
147
+ data = sse.json()
148
+ if is_mapping(data) and data.get("error"):
149
+ message = None
150
+ error = data.get("error")
151
+ if is_mapping(error):
152
+ message = error.get("message")
153
+ if not message or not isinstance(message, str):
154
+ message = "An error occurred during streaming"
155
+
156
+ raise APIError(
157
+ message=message,
158
+ request=self.response.request,
159
+ body=data["error"],
160
+ )
161
+
162
+ yield process_data(data=data, cast_to=cast_to, response=response)
163
+ finally:
164
+ # Ensure the response is closed even if the consumer doesn't read all data
165
+ await response.aclose()
164
166
 
165
167
  async def __aenter__(self) -> Self:
166
168
  return self
together/_utils/_utils.py CHANGED
@@ -373,7 +373,7 @@ def get_required_header(headers: HeadersLike, header: str) -> str:
373
373
  lower_header = header.lower()
374
374
  if is_mapping_t(headers):
375
375
  # mypy doesn't understand the type narrowing here
376
- for k, v in headers.items(): # type: ignore[misc, has-type]
376
+ for k, v in headers.items(): # type: ignore[misc, has-type, attr-defined]
377
377
  if k.lower() == lower_header and isinstance(v, str): # type: ignore[has-type]
378
378
  return v # type: ignore[has-type]
379
379
 
together/_version.py CHANGED
@@ -1,4 +1,4 @@
1
1
  # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  __title__ = "together"
4
- __version__ = "2.0.0-alpha.7" # x-release-please-version
4
+ __version__ = "2.0.0-alpha.9" # x-release-please-version
@@ -128,8 +128,7 @@ def endpoints(ctx: click.Context) -> None:
128
128
  help="Start endpoint in specified availability zone (e.g., us-central-4b)",
129
129
  )
130
130
  @click.option(
131
- "--wait",
132
- is_flag=True,
131
+ "--wait/--no-wait",
133
132
  default=True,
134
133
  help="Wait for the endpoint to be ready after creation",
135
134
  )
@@ -272,7 +271,7 @@ def fetch_and_print_hardware_options(client: Together, model: str | None, print_
272
271
 
273
272
  @endpoints.command()
274
273
  @click.argument("endpoint-id", required=True)
275
- @click.option("--wait", is_flag=True, default=True, help="Wait for the endpoint to stop")
274
+ @click.option("--wait/--no-wait", default=True, help="Wait for the endpoint to stop")
276
275
  @click.pass_obj
277
276
  @handle_api_errors
278
277
  def stop(client: Together, endpoint_id: str, wait: bool) -> None:
@@ -293,7 +292,7 @@ def stop(client: Together, endpoint_id: str, wait: bool) -> None:
293
292
 
294
293
  @endpoints.command()
295
294
  @click.argument("endpoint-id", required=True)
296
- @click.option("--wait", is_flag=True, default=True, help="Wait for the endpoint to start")
295
+ @click.option("--wait/--no-wait", default=True, help="Wait for the endpoint to start")
297
296
  @click.pass_obj
298
297
  @handle_api_errors
299
298
  def start(client: Together, endpoint_id: str, wait: bool) -> None:
@@ -70,9 +70,6 @@ class FinetuneEventLevels(str, Enum):
70
70
  INFO = "Info"
71
71
  WARNING = "Warning"
72
72
  ERROR = "Error"
73
- LEGACY_INFO = "info"
74
- LEGACY_IWARNING = "warning"
75
- LEGACY_IERROR = "error"
76
73
 
77
74
 
78
75
  class FinetuneEvent(BaseModel):
@@ -85,7 +82,7 @@ class FinetuneEvent(BaseModel):
85
82
  # created at datetime stamp
86
83
  created_at: Union[str, None] = None
87
84
  # event log level
88
- level: Union[FinetuneEventLevels, None] = None
85
+ level: Union[FinetuneEventLevels, str, None] = None
89
86
  # event message string
90
87
  message: Union[str, None] = None
91
88
  # event type
@@ -120,7 +117,20 @@ class LoRATrainingType(BaseModel):
120
117
  type: Literal["Lora"] = "Lora"
121
118
 
122
119
 
123
- TrainingType: TypeAlias = Union[FullTrainingType, LoRATrainingType]
120
+ class UnknownTrainingType(BaseModel):
121
+ """
122
+ Catch-all for unknown training types (forward compatibility).
123
+ Accepts any training type not explicitly defined.
124
+ """
125
+
126
+ type: str
127
+
128
+
129
+ TrainingType: TypeAlias = Union[
130
+ FullTrainingType,
131
+ LoRATrainingType,
132
+ UnknownTrainingType,
133
+ ]
124
134
 
125
135
 
126
136
  class FinetuneFullTrainingLimits(BaseModel):
@@ -163,7 +173,19 @@ class TrainingMethodDPO(BaseModel):
163
173
  simpo_gamma: Union[float, None] = None
164
174
 
165
175
 
166
- TrainingMethod: TypeAlias = Union[TrainingMethodSFT, TrainingMethodDPO]
176
+ class TrainingMethodUnknown(BaseModel):
177
+ """
178
+ Catch-all for unknown training methods (forward compatibility).
179
+ Accepts any training method not explicitly defined.
180
+ """
181
+
182
+ method: str
183
+
184
+ TrainingMethod: TypeAlias = Union[
185
+ TrainingMethodSFT,
186
+ TrainingMethodDPO,
187
+ TrainingMethodUnknown,
188
+ ]
167
189
 
168
190
 
169
191
  class FinetuneTrainingLimits(BaseModel):
@@ -175,31 +197,67 @@ class FinetuneTrainingLimits(BaseModel):
175
197
 
176
198
 
177
199
  class LinearLRSchedulerArgs(BaseModel):
200
+ """
201
+ Linear learning rate scheduler arguments
202
+ """
203
+
178
204
  min_lr_ratio: Union[float, None] = 0.0
179
205
 
180
206
 
181
207
  class CosineLRSchedulerArgs(BaseModel):
208
+ """
209
+ Cosine learning rate scheduler arguments
210
+ """
211
+
182
212
  min_lr_ratio: Union[float, None] = 0.0
183
213
  num_cycles: Union[float, None] = 0.5
184
214
 
185
215
 
186
216
  class LinearLRScheduler(BaseModel):
217
+ """
218
+ Linear learning rate scheduler
219
+ """
220
+
187
221
  lr_scheduler_type: Literal["linear"] = "linear"
188
222
  lr_scheduler_args: Union[LinearLRSchedulerArgs, None] = None
189
223
 
190
224
 
191
225
  class CosineLRScheduler(BaseModel):
226
+ """
227
+ Cosine learning rate scheduler
228
+ """
229
+
192
230
  lr_scheduler_type: Literal["cosine"] = "cosine"
193
231
  lr_scheduler_args: Union[CosineLRSchedulerArgs, None] = None
194
232
 
195
233
 
196
- # placeholder for old fine-tuning jobs with no lr_scheduler_type specified
197
234
  class EmptyLRScheduler(BaseModel):
235
+ """
236
+ Empty learning rate scheduler
237
+
238
+ Placeholder for old fine-tuning jobs with no lr_scheduler_type specified
239
+ """
240
+
198
241
  lr_scheduler_type: Literal[""]
199
242
  lr_scheduler_args: None = None
200
243
 
244
+ class UnknownLRScheduler(BaseModel):
245
+ """
246
+ Unknown learning rate scheduler
247
+
248
+ Catch-all for unknown LR scheduler types (forward compatibility)
249
+ """
250
+
251
+ lr_scheduler_type: str
252
+ lr_scheduler_args: Optional[Any] = None
253
+
201
254
 
202
- FinetuneLRScheduler: TypeAlias = Union[LinearLRScheduler, CosineLRScheduler, EmptyLRScheduler]
255
+ FinetuneLRScheduler: TypeAlias = Union[
256
+ LinearLRScheduler,
257
+ CosineLRScheduler,
258
+ EmptyLRScheduler,
259
+ UnknownLRScheduler,
260
+ ]
203
261
 
204
262
 
205
263
  class FinetuneResponse(BaseModel):
@@ -213,8 +271,8 @@ class FinetuneResponse(BaseModel):
213
271
  created_at: datetime
214
272
  """Creation timestamp of the fine-tune job"""
215
273
 
216
- status: Optional[FinetuneJobStatus] = None
217
- """Status of the fine-tune job"""
274
+ status: Optional[Union[FinetuneJobStatus, str]] = None
275
+ """Status of the fine-tune job (accepts known enum values or string for forward compatibility)"""
218
276
 
219
277
  updated_at: datetime
220
278
  """Last update timestamp of the fine-tune job"""
@@ -222,8 +280,8 @@ class FinetuneResponse(BaseModel):
222
280
  batch_size: Optional[int] = None
223
281
  """Batch size used for training"""
224
282
 
225
- events: Optional[List[FinetuneEvent]] = None
226
- """Events related to this fine-tune job"""
283
+ events: Optional[List[Union[FinetuneEvent, str]]] = None
284
+ """Events related to this fine-tune job (accepts known enum values or string for forward compatibility)"""
227
285
 
228
286
  from_checkpoint: Optional[str] = None
229
287
  """Checkpoint used to continue training"""
@@ -361,7 +419,7 @@ class FinetuneRequest(BaseModel):
361
419
  # training learning rate
362
420
  learning_rate: float
363
421
  # learning rate scheduler type and args
364
- lr_scheduler: Union[LinearLRScheduler, CosineLRScheduler, None] = None
422
+ lr_scheduler: Union[FinetuneLRScheduler, None] = None
365
423
  # learning rate warmup ratio
366
424
  warmup_ratio: float
367
425
  # max gradient norm
@@ -387,7 +445,7 @@ class FinetuneRequest(BaseModel):
387
445
  # training type
388
446
  training_type: Union[TrainingType, None] = None
389
447
  # training method
390
- training_method: Union[TrainingMethodSFT, TrainingMethodDPO] = Field(default_factory=TrainingMethodSFT)
448
+ training_method: TrainingMethod = Field(default_factory=TrainingMethodSFT)
391
449
  # from step
392
450
  from_checkpoint: Union[str, None] = None
393
451
  from_hf_model: Union[str, None] = None
@@ -50,6 +50,8 @@ class TranscriptionsResource(SyncAPIResource):
50
50
  file: FileTypes,
51
51
  diarize: bool | Omit = omit,
52
52
  language: str | Omit = omit,
53
+ max_speakers: int | Omit = omit,
54
+ min_speakers: int | Omit = omit,
53
55
  model: Literal["openai/whisper-large-v3"] | Omit = omit,
54
56
  prompt: str | Omit = omit,
55
57
  response_format: Literal["json", "verbose_json"] | Omit = omit,
@@ -82,6 +84,12 @@ class TranscriptionsResource(SyncAPIResource):
82
84
  language: Optional ISO 639-1 language code. If `auto` is provided, language is
83
85
  auto-detected.
84
86
 
87
+ max_speakers: Maximum number of speakers expected in the audio. Used to improve diarization
88
+ accuracy when the approximate number of speakers is known.
89
+
90
+ min_speakers: Minimum number of speakers expected in the audio. Used to improve diarization
91
+ accuracy when the approximate number of speakers is known.
92
+
85
93
  model: Model to use for transcription
86
94
 
87
95
  prompt: Optional text to bias decoding.
@@ -107,6 +115,8 @@ class TranscriptionsResource(SyncAPIResource):
107
115
  "file": file,
108
116
  "diarize": diarize,
109
117
  "language": language,
118
+ "max_speakers": max_speakers,
119
+ "min_speakers": min_speakers,
110
120
  "model": model,
111
121
  "prompt": prompt,
112
122
  "response_format": response_format,
@@ -161,6 +171,8 @@ class AsyncTranscriptionsResource(AsyncAPIResource):
161
171
  file: FileTypes,
162
172
  diarize: bool | Omit = omit,
163
173
  language: str | Omit = omit,
174
+ max_speakers: int | Omit = omit,
175
+ min_speakers: int | Omit = omit,
164
176
  model: Literal["openai/whisper-large-v3"] | Omit = omit,
165
177
  prompt: str | Omit = omit,
166
178
  response_format: Literal["json", "verbose_json"] | Omit = omit,
@@ -193,6 +205,12 @@ class AsyncTranscriptionsResource(AsyncAPIResource):
193
205
  language: Optional ISO 639-1 language code. If `auto` is provided, language is
194
206
  auto-detected.
195
207
 
208
+ max_speakers: Maximum number of speakers expected in the audio. Used to improve diarization
209
+ accuracy when the approximate number of speakers is known.
210
+
211
+ min_speakers: Minimum number of speakers expected in the audio. Used to improve diarization
212
+ accuracy when the approximate number of speakers is known.
213
+
196
214
  model: Model to use for transcription
197
215
 
198
216
  prompt: Optional text to bias decoding.
@@ -218,6 +236,8 @@ class AsyncTranscriptionsResource(AsyncAPIResource):
218
236
  "file": file,
219
237
  "diarize": diarize,
220
238
  "language": language,
239
+ "max_speakers": max_speakers,
240
+ "min_speakers": min_speakers,
221
241
  "model": model,
222
242
  "prompt": prompt,
223
243
  "response_format": response_format,
@@ -291,7 +291,7 @@ class FineTuningResource(SyncAPIResource):
291
291
  self,
292
292
  id: str,
293
293
  *,
294
- force: bool,
294
+ force: bool | Omit = omit,
295
295
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
296
296
  # The extra values given here take precedence over values defined on the client or passed to this method.
297
297
  extra_headers: Headers | None = None,
@@ -374,7 +374,7 @@ class FineTuningResource(SyncAPIResource):
374
374
  timeout: float | httpx.Timeout | None | NotGiven = not_given,
375
375
  ) -> BinaryAPIResponse:
376
376
  """
377
- Download a compressed fine-tuned model or checkpoint.
377
+ Receive a compressed fine-tuned model or checkpoint.
378
378
 
379
379
  Args:
380
380
  ft_id: Fine-tune ID to download. A string that starts with `ft-`.
@@ -732,7 +732,7 @@ class AsyncFineTuningResource(AsyncAPIResource):
732
732
  self,
733
733
  id: str,
734
734
  *,
735
- force: bool,
735
+ force: bool | Omit = omit,
736
736
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
737
737
  # The extra values given here take precedence over values defined on the client or passed to this method.
738
738
  extra_headers: Headers | None = None,
@@ -815,7 +815,7 @@ class AsyncFineTuningResource(AsyncAPIResource):
815
815
  timeout: float | httpx.Timeout | None | NotGiven = not_given,
816
816
  ) -> AsyncBinaryAPIResponse:
817
817
  """
818
- Download a compressed fine-tuned model or checkpoint.
818
+ Receive a compressed fine-tuned model or checkpoint.
819
819
 
820
820
  Args:
821
821
  ft_id: Fine-tune ID to download. A string that starts with `ft-`.
@@ -8,7 +8,7 @@ from typing_extensions import Literal
8
8
  import httpx
9
9
 
10
10
  from ..types import image_generate_params
11
- from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
11
+ from .._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given
12
12
  from .._utils import maybe_transform, async_maybe_transform
13
13
  from .._compat import cached_property
14
14
  from .._resource import SyncAPIResource, AsyncAPIResource
@@ -64,6 +64,7 @@ class ImagesResource(SyncAPIResource):
64
64
  n: int | Omit = omit,
65
65
  negative_prompt: str | Omit = omit,
66
66
  output_format: Literal["jpeg", "png"] | Omit = omit,
67
+ reference_images: SequenceNotStr[str] | Omit = omit,
67
68
  response_format: Literal["base64", "url"] | Omit = omit,
68
69
  seed: int | Omit = omit,
69
70
  steps: int | Omit = omit,
@@ -105,6 +106,10 @@ class ImagesResource(SyncAPIResource):
105
106
  output_format: The format of the image response. Can be either be `jpeg` or `png`. Defaults to
106
107
  `jpeg`.
107
108
 
109
+ reference_images: An array of image URLs that guide the overall appearance and style of the
110
+ generated image. These reference images influence the visual characteristics
111
+ consistently across the generation.
112
+
108
113
  response_format: Format of the image response. Can be either a base64 string or a URL.
109
114
 
110
115
  seed: Seed used for generation. Can be used to reproduce image generations.
@@ -135,6 +140,7 @@ class ImagesResource(SyncAPIResource):
135
140
  "n": n,
136
141
  "negative_prompt": negative_prompt,
137
142
  "output_format": output_format,
143
+ "reference_images": reference_images,
138
144
  "response_format": response_format,
139
145
  "seed": seed,
140
146
  "steps": steps,
@@ -189,6 +195,7 @@ class AsyncImagesResource(AsyncAPIResource):
189
195
  n: int | Omit = omit,
190
196
  negative_prompt: str | Omit = omit,
191
197
  output_format: Literal["jpeg", "png"] | Omit = omit,
198
+ reference_images: SequenceNotStr[str] | Omit = omit,
192
199
  response_format: Literal["base64", "url"] | Omit = omit,
193
200
  seed: int | Omit = omit,
194
201
  steps: int | Omit = omit,
@@ -230,6 +237,10 @@ class AsyncImagesResource(AsyncAPIResource):
230
237
  output_format: The format of the image response. Can be either be `jpeg` or `png`. Defaults to
231
238
  `jpeg`.
232
239
 
240
+ reference_images: An array of image URLs that guide the overall appearance and style of the
241
+ generated image. These reference images influence the visual characteristics
242
+ consistently across the generation.
243
+
233
244
  response_format: Format of the image response. Can be either a base64 string or a URL.
234
245
 
235
246
  seed: Seed used for generation. Can be used to reproduce image generations.
@@ -260,6 +271,7 @@ class AsyncImagesResource(AsyncAPIResource):
260
271
  "n": n,
261
272
  "negative_prompt": negative_prompt,
262
273
  "output_format": output_format,
274
+ "reference_images": reference_images,
263
275
  "response_format": response_format,
264
276
  "seed": seed,
265
277
  "steps": steps,
@@ -20,7 +20,6 @@ from .._response import (
20
20
  )
21
21
  from .._base_client import make_request_options
22
22
  from ..types.video_job import VideoJob
23
- from ..types.video_create_response import VideoCreateResponse
24
23
 
25
24
  __all__ = ["VideosResource", "AsyncVideosResource"]
26
25
 
@@ -68,7 +67,7 @@ class VideosResource(SyncAPIResource):
68
67
  extra_query: Query | None = None,
69
68
  extra_body: Body | None = None,
70
69
  timeout: float | httpx.Timeout | None | NotGiven = not_given,
71
- ) -> VideoCreateResponse:
70
+ ) -> VideoJob:
72
71
  """
73
72
  Create a video
74
73
 
@@ -139,7 +138,7 @@ class VideosResource(SyncAPIResource):
139
138
  options=make_request_options(
140
139
  extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
141
140
  ),
142
- cast_to=VideoCreateResponse,
141
+ cast_to=VideoJob,
143
142
  )
144
143
 
145
144
  def retrieve(
@@ -219,7 +218,7 @@ class AsyncVideosResource(AsyncAPIResource):
219
218
  extra_query: Query | None = None,
220
219
  extra_body: Body | None = None,
221
220
  timeout: float | httpx.Timeout | None | NotGiven = not_given,
222
- ) -> VideoCreateResponse:
221
+ ) -> VideoJob:
223
222
  """
224
223
  Create a video
225
224
 
@@ -290,7 +289,7 @@ class AsyncVideosResource(AsyncAPIResource):
290
289
  options=make_request_options(
291
290
  extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
292
291
  ),
293
- cast_to=VideoCreateResponse,
292
+ cast_to=VideoJob,
294
293
  )
295
294
 
296
295
  async def retrieve(
@@ -46,7 +46,6 @@ from .batch_create_response import BatchCreateResponse as BatchCreateResponse
46
46
  from .image_generate_params import ImageGenerateParams as ImageGenerateParams
47
47
  from .job_retrieve_response import JobRetrieveResponse as JobRetrieveResponse
48
48
  from .model_upload_response import ModelUploadResponse as ModelUploadResponse
49
- from .video_create_response import VideoCreateResponse as VideoCreateResponse
50
49
  from .endpoint_create_params import EndpointCreateParams as EndpointCreateParams
51
50
  from .endpoint_list_response import EndpointListResponse as EndpointListResponse
52
51
  from .endpoint_update_params import EndpointUpdateParams as EndpointUpdateParams
@@ -34,6 +34,20 @@ class TranscriptionCreateParams(TypedDict, total=False):
34
34
  If `auto` is provided, language is auto-detected.
35
35
  """
36
36
 
37
+ max_speakers: int
38
+ """Maximum number of speakers expected in the audio.
39
+
40
+ Used to improve diarization accuracy when the approximate number of speakers is
41
+ known.
42
+ """
43
+
44
+ min_speakers: int
45
+ """Minimum number of speakers expected in the audio.
46
+
47
+ Used to improve diarization accuracy when the approximate number of speakers is
48
+ known.
49
+ """
50
+
37
51
  model: Literal["openai/whisper-large-v3"]
38
52
  """Model to use for transcription"""
39
53
 
@@ -2,10 +2,10 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing_extensions import Required, TypedDict
5
+ from typing_extensions import TypedDict
6
6
 
7
7
  __all__ = ["FineTuningDeleteParams"]
8
8
 
9
9
 
10
10
  class FineTuningDeleteParams(TypedDict, total=False):
11
- force: Required[bool]
11
+ force: bool
@@ -5,6 +5,8 @@ from __future__ import annotations
5
5
  from typing import Union, Iterable
6
6
  from typing_extensions import Literal, Required, TypedDict
7
7
 
8
+ from .._types import SequenceNotStr
9
+
8
10
  __all__ = ["ImageGenerateParams", "ImageLora"]
9
11
 
10
12
 
@@ -61,6 +63,13 @@ class ImageGenerateParams(TypedDict, total=False):
61
63
  Can be either be `jpeg` or `png`. Defaults to `jpeg`.
62
64
  """
63
65
 
66
+ reference_images: SequenceNotStr[str]
67
+ """
68
+ An array of image URLs that guide the overall appearance and style of the
69
+ generated image. These reference images influence the visual characteristics
70
+ consistently across the generation.
71
+ """
72
+
64
73
  response_format: Literal["base64", "url"]
65
74
  """Format of the image response. Can be either a base64 string or a URL."""
66
75
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: together
3
- Version: 2.0.0a7
3
+ Version: 2.0.0a9
4
4
  Summary: The official Python library for the together API
5
5
  Project-URL: Homepage, https://github.com/togethercomputer/together-py
6
6
  Project-URL: Repository, https://github.com/togethercomputer/together-py
@@ -144,6 +144,7 @@ pip install 'together[aiohttp] @ git+ssh://git@github.com/togethercomputer/toget
144
144
  Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:
145
145
 
146
146
  ```python
147
+ import os
147
148
  import asyncio
148
149
  from together import DefaultAioHttpClient
149
150
  from together import AsyncTogether
@@ -151,7 +152,7 @@ from together import AsyncTogether
151
152
 
152
153
  async def main() -> None:
153
154
  async with AsyncTogether(
154
- api_key="My API Key",
155
+ api_key=os.environ.get("TOGETHER_API_KEY"), # This is the default and can be omitted
155
156
  http_client=DefaultAioHttpClient(),
156
157
  ) as client:
157
158
  chat_completion = await client.chat.completions.create(
@@ -244,22 +245,6 @@ chat_completion = client.chat.completions.create(
244
245
  print(chat_completion.response_format)
245
246
  ```
246
247
 
247
- ## File uploads
248
-
249
- Request parameters that correspond to file uploads can be passed as `bytes`, or a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance or a tuple of `(filename, contents, media type)`.
250
-
251
- ```python
252
- from pathlib import Path
253
- from together import Together
254
-
255
- client = Together()
256
-
257
- client.files.upload(
258
- file=Path("/path/to/file"),
259
- purpose="fine-tune",
260
- )
261
- ```
262
-
263
248
  The async client uses the exact same interface. If you pass a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance, the file contents will be read asynchronously automatically.
264
249
 
265
250
  ## Handling errors
@@ -528,40 +513,6 @@ with Together() as client:
528
513
 
529
514
  ## Usage – CLI
530
515
 
531
- ### Chat Completions
532
-
533
- ```bash
534
- together chat.completions \
535
- --message "system" "You are a helpful assistant named Together" \
536
- --message "user" "What is your name?" \
537
- --model mistralai/Mixtral-8x7B-Instruct-v0.1
538
- ```
539
-
540
- The Chat Completions CLI enables streaming tokens to stdout by default. To disable streaming, use `--no-stream`.
541
-
542
- ### Completions
543
-
544
- ```bash
545
- together completions \
546
- "Large language models are " \
547
- --model mistralai/Mixtral-8x7B-v0.1 \
548
- --max-tokens 512 \
549
- --stop "."
550
- ```
551
-
552
- The Completions CLI enables streaming tokens to stdout by default. To disable streaming, use `--no-stream`.
553
-
554
- ### Image Generations
555
-
556
- ```bash
557
- together images generate \
558
- "space robots" \
559
- --model stabilityai/stable-diffusion-xl-base-1.0 \
560
- --n 4
561
- ```
562
-
563
- The image is opened in the default image viewer by default. To disable this, use `--no-show`.
564
-
565
516
  ### Files
566
517
 
567
518
  ```bash
@@ -9,9 +9,9 @@ together/_models.py,sha256=3D65psj_C02Mw0K2zpBWrn1khmrvtEXgTTQ6P4r3tUY,31837
9
9
  together/_qs.py,sha256=craIKyvPktJ94cvf9zn8j8ekG9dWJzhWv0ob34lIOv4,4828
10
10
  together/_resource.py,sha256=-ZTq9O5qf2YsgjJk_gwJs-CM_OG4p6gdMLcNWjuxFwQ,1112
11
11
  together/_response.py,sha256=lvqEsCbpD8SRJTjlhhUFGbnLUR_4-Qva-OApxfVdiY4,28800
12
- together/_streaming.py,sha256=SgGfDGFD2J4pNdMrj--YjD8tCjfEj-htf_Jk6q1aby4,11625
12
+ together/_streaming.py,sha256=sk6fVYbpdO3Y-0S5iwZTHQJ3N24UkK0KaupgUTftWZk,11825
13
13
  together/_types.py,sha256=nL3wDyii53Z400Anq1qLS1pEW0PwQId-OjnbRJDwoj4,7238
14
- together/_version.py,sha256=Ka0Gs567t27ygs2-oPANbfh_j61uZB-jYvgun8LTzTg,168
14
+ together/_version.py,sha256=p3SWLX96_Ba9f7WpAgA4thdvwcM0aML58lmPvGUECTE,168
15
15
  together/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
16
  together/_utils/__init__.py,sha256=7fch0GT9zpNnErbciSpUNa-SjTxxjY6kxHxKMOM4AGs,2305
17
17
  together/_utils/_compat.py,sha256=rN17SSvjMoQE1GmKFTLniRuG1sKj2WAD5VjdLPeRlF0,1231
@@ -24,14 +24,14 @@ together/_utils/_streams.py,sha256=SMC90diFFecpEg_zgDRVbdR3hSEIgVVij4taD-noMLM,2
24
24
  together/_utils/_sync.py,sha256=HBnZkkBnzxtwOZe0212C4EyoRvxhTVtTrLFDz2_xVCg,1589
25
25
  together/_utils/_transform.py,sha256=NjCzmnfqYrsAikUHQig6N9QfuTVbKipuP3ur9mcNF-E,15951
26
26
  together/_utils/_typing.py,sha256=N_5PPuFNsaygbtA_npZd98SVN1LQQvFTKL6bkWPBZGU,4786
27
- together/_utils/_utils.py,sha256=zaHjfH3uG2SSJUqIPCWRaTCkTBNm_1hw-P-ZV0XZHec,12320
27
+ together/_utils/_utils.py,sha256=g9ftElB09kVT6EVfCIlD_nUfANhDX5_vZO61FDWoIQI,12334
28
28
  together/lib/.keep,sha256=wuNrz-5SXo3jJaJOJgz4vFHM41YH_g20F5cRQo0vLes,224
29
29
  together/lib/__init__.py,sha256=Qtdi6geFNzxE-F51eNDk1ESXYyYDt8b82MR1POANQBQ,394
30
30
  together/lib/constants.py,sha256=EgcTlmk4QqVqjZjGej5k5JEwoRqidlITQ8LQqzW0dXI,1795
31
31
  together/lib/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
32
32
  together/lib/cli/cli.py,sha256=bNzYeLF8JdlMnSmIqFClp28MzjLGCwQ9hqSpaXHBQ0s,1939
33
33
  together/lib/cli/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
34
- together/lib/cli/api/endpoints.py,sha256=4hUkoNwobyF4rNaXLB7Xkazp_yYAyp6ai2d68Xxly-o,14867
34
+ together/lib/cli/api/endpoints.py,sha256=MyliUrTuJWw2qFd80J27pFs9xTazIVAP0mqgRYxdVsw,14851
35
35
  together/lib/cli/api/evals.py,sha256=KkSvz2wIYmPQ3sFQBte6inNBZt1aptIkMVL5TKWTW5k,19074
36
36
  together/lib/cli/api/files.py,sha256=HbflC45PpzBIF0CE0TLucQaVr319ScL05VyAFKf2T6Y,3596
37
37
  together/lib/cli/api/fine_tuning.py,sha256=yTkFpzgvcfhdvdocbG9ftWfs9SfeZj5jFHHmTO1MxTY,19909
@@ -43,7 +43,7 @@ together/lib/resources/fine_tuning.py,sha256=vQIcUKuDsl5XY5Qf9l5kwtuIFEB3L89K63c
43
43
  together/lib/resources/models.py,sha256=h3UZxMzz0Kq9Lzp3KaL0HLcUco1fqtwWanxPB16g_1g,1118
44
44
  together/lib/types/__init__.py,sha256=1-kHsAp9Sh9HxjTGKfdHnF1nTS_cM_Tazv-3Z9hrEbY,205
45
45
  together/lib/types/error.py,sha256=i-rnTZPRZuJDUf1lM-52abG2JHWOUBTCh55zPNGoakg,135
46
- together/lib/types/fine_tuning.py,sha256=_r6sVspzuxdLLaP7TLGknD13Nk5YmrMq3JtLEXCEdLw,11513
46
+ together/lib/types/fine_tuning.py,sha256=DN8mTSna3ptO-gQJBy_MnAZ-Zw6jOwZNuA73eVBt5l8,12555
47
47
  together/lib/utils/__init__.py,sha256=F_CVqnvK-aEshMg-5FLFincPbhuVbsM6IKSCNyEByKs,545
48
48
  together/lib/utils/_log.py,sha256=mo5tDhyFTNqEj8MOcpy3bLmLBcC0OQ67orTw_nxFdcU,1930
49
49
  together/lib/utils/files.py,sha256=S6orZixBPeRtV_iq_IktuYHIm41irrHuOuexz_NYZJ0,24863
@@ -56,17 +56,17 @@ together/resources/embeddings.py,sha256=7EU6DZQd0Nm0Sh7x7v37QQOLNuLqNmcjdJAyOTck
56
56
  together/resources/endpoints.py,sha256=dYdLlAJ0P7HJNhzZGxlbzEQYpUWsh35cjAMVfdWiifw,27884
57
57
  together/resources/evals.py,sha256=FPjvkbsBY5rrzLyQ-X1G9fWt2QmivI9ol5GExGtqYVA,16216
58
58
  together/resources/files.py,sha256=0paHeVqNt3NQCXoztCgFS8PEIg_-mMVto-ulHTr7GzE,16854
59
- together/resources/fine_tuning.py,sha256=w0onlDx3rkrFuMxvWmGUNDor-GSRh1vPc7jWqhGQBsM,45289
59
+ together/resources/fine_tuning.py,sha256=gjGJn1bAZlHHRGhjhfrZ7bNU1AgTtrQqSK4BshL47Hg,45315
60
60
  together/resources/hardware.py,sha256=xgfCmMrrwF5o1igax0JGec8RY7kkS0s4kKm62RdC3ME,6850
61
- together/resources/images.py,sha256=hRXxDtMl3oBeMq0dfkdyvu4Qi1YqB_dhFsan0wynUk8,11870
61
+ together/resources/images.py,sha256=mVPQYpDHKBjLVO_Sv0uT62zYXdtWKN2PW3fCvfQLQCs,12612
62
62
  together/resources/jobs.py,sha256=TnzSnvJw4x5pqo1xzrkYH8f0viZrzyOqT-_w7xc0NzY,7797
63
63
  together/resources/models.py,sha256=kb4OeIFbyfzCE_4rO87i4AMlnuDoTa3pXqKKG95VoLo,10614
64
64
  together/resources/rerank.py,sha256=Xoaco2OvKdII7AhPaJDqUqoXmJvXbTWmY4_g_aqq8dQ,8334
65
- together/resources/videos.py,sha256=HCiCO58gZ75bMDWFqYPRdicoGkUsXJXjY0YycnDnT2c,14989
65
+ together/resources/videos.py,sha256=AdcC08JrUtbcEJV-G0viH4CF1qU9oNjdjQ7U38QCEkU,14883
66
66
  together/resources/audio/__init__.py,sha256=MKUWFwFsAdCf9LrO8AiUCeIzdknPNDPr4lpAt-pkYSw,2521
67
67
  together/resources/audio/audio.py,sha256=stpvzuxIwMnAQLQnqW1KRxx3G_DI-oDSnx3uDN_X1R8,7180
68
68
  together/resources/audio/speech.py,sha256=ZavAHDhi8rKzIQ0tRTv1UOIlUJQ5_ArvH3JG1JdN41M,27560
69
- together/resources/audio/transcriptions.py,sha256=j_ySc6787yilePUVK-fb_NbCOydLAvsJ3JsM5pWS3L0,11913
69
+ together/resources/audio/transcriptions.py,sha256=k5zLDKXNqISjeieSyi1FKbyKsWyhnkeIkApG3l7QzeY,12965
70
70
  together/resources/audio/translations.py,sha256=zeV1wJPGzBmQGGgSPNA_vigy_4yuV3aBq6sSLa19-jg,10251
71
71
  together/resources/audio/voices.py,sha256=Lj9DtOcv_Dhaq3E5p7Oty1T_JkhrsGDZcDF91HHA3Yw,4905
72
72
  together/resources/chat/__init__.py,sha256=BVAfz9TM3DT5W9f_mt0P9YRxL_MsUxKCWAH6u1iogmA,1041
@@ -75,7 +75,7 @@ together/resources/chat/completions.py,sha256=bgOO_1BBhVDMiTN3brn11Rt1BpDPmfHYrk
75
75
  together/resources/code_interpreter/__init__.py,sha256=qeNVuBUuYy66RDhyh4RDx_xsf0gTMIrrZkZHpkPy9r0,1146
76
76
  together/resources/code_interpreter/code_interpreter.py,sha256=ZrWQIn5FO-uau3qTt_HhsHiaclM_ZNfOqZI_AWT2SMk,10373
77
77
  together/resources/code_interpreter/sessions.py,sha256=Sl8X6-r1gds2VHhzpjPhfwYNTciZCJxAH-YjJerA_eU,5020
78
- together/types/__init__.py,sha256=inrKEzp0lOD0KXA0D7iLuA5vAFGAeyCPQaHskGRJVTU,4539
78
+ together/types/__init__.py,sha256=hq3GuuB078PZuKe7BgP1CJCRAOlNO1fgi2O23YCFPEE,4461
79
79
  together/types/audio_speech_stream_chunk.py,sha256=npxlsMce0q4_VoJaZzfSh982TYTM0-j-zmhyI-9hP5o,346
80
80
  together/types/autoscaling.py,sha256=JipJZsNblLTE3XN5hglJy2KdffI1A2UGB5nIx6_imFQ,371
81
81
  together/types/autoscaling_param.py,sha256=rMCfBYYswaJIHTSsnnICtZ2barAbgbdzhaHDyAEav30,468
@@ -109,7 +109,7 @@ together/types/file_response.py,sha256=Abmu-Ph-masbhAFePB64VhiswHEFmExWF34jaiTm4
109
109
  together/types/file_type.py,sha256=lrvFtcJr0Wn5thWP4NihmrmK23AouK2e6Ev4LCCPg5A,218
110
110
  together/types/fine_tuning_cancel_response.py,sha256=aPZPl8nzBs5tGk1gq-Ah35_vzibCyaeJIq-iZi0g2XQ,5220
111
111
  together/types/fine_tuning_content_params.py,sha256=_5rqZ2lk6FShmX-5Hj4A9jQdpPZP6lcgjXvnrC30G8k,711
112
- together/types/fine_tuning_delete_params.py,sha256=Xs2UW6-h0M7TZ7uMPht6CP2z62iOwWo6QP0DPuzWe04,293
112
+ together/types/fine_tuning_delete_params.py,sha256=YwUcN_gFl9N2zuUJqyOrE0ngONL2N_OgfVw6h-sH2RE,273
113
113
  together/types/fine_tuning_delete_response.py,sha256=oWoJM51-2b_RIINhJSMyMelSKQkHFYrJjDLeD51dUgo,323
114
114
  together/types/fine_tuning_list_checkpoints_response.py,sha256=9S0kRl7ItqFU6CeodrB9jb1zgf7-Ehb7VGjsbKq_hBY,377
115
115
  together/types/fine_tuning_list_events_response.py,sha256=DeDJLF1IxQV47HOwfuVt8Zis5W2CKs3iKkKvwDxyswk,309
@@ -122,7 +122,7 @@ together/types/hardware_list_response.py,sha256=cUhOyWYc_Z8-FRBHUgNgA3fI0XTfPgUq
122
122
  together/types/image_data_b64.py,sha256=pLY7JDBb1HF1T29ACbae_xn6JQfttpqQVeG_jJeenZU,284
123
123
  together/types/image_data_url.py,sha256=6A_EYNfcR6Z6sZkyC4MThxeZnK2cvTuQn6-A1dXM85w,274
124
124
  together/types/image_file.py,sha256=sADh0UcrGlemkreIvHBEBizstAvt64CVOu7KtOALcHk,569
125
- together/types/image_generate_params.py,sha256=siOZ7I-pVD61nx3nIwCw7HfMgK-u1SJkMMdUs-7Akkw,2488
125
+ together/types/image_generate_params.py,sha256=bdOsD1NXYjCq8QT27wCd8P1hGWIfCd70E8u6n8TLzGQ,2783
126
126
  together/types/job_list_response.py,sha256=y7tFXGH2dYD9PfVH2_2Rf6RDkWsW4olljXt5FnGO6UA,950
127
127
  together/types/job_retrieve_response.py,sha256=I4HHmSUCAVFuy2RkrZuanssaPLRkDmG_i0Qc192yRmM,880
128
128
  together/types/log_probs.py,sha256=A1DD9Cdb5G7bufrBiaMZC4HJ7v1NH5_zFEYvLgFY1NI,473
@@ -138,11 +138,10 @@ together/types/tools_param.py,sha256=dRo4u37j5nyjhyU_yc2_l5smDOs76UhQluB-CMq8BMU
138
138
  together/types/training_method_dpo.py,sha256=INdq7tJYKBhY_Hwodn217h-9-7q4IX6mJdRN4P44vdQ,519
139
139
  together/types/training_method_sft.py,sha256=Ro9vRS2Kw9e5HENJ6BXLGZjqKsfTsrGLfoVljoOlHgw,453
140
140
  together/types/video_create_params.py,sha256=9Mx7TWTaPHOOpaMezz9FD5VC7hN6jGbnynGlUNPr8U0,2657
141
- together/types/video_create_response.py,sha256=OBrwAfRsPIdhkoNSk4pBunjWNkk-yAa9VhE-YzgVqO8,253
142
141
  together/types/video_job.py,sha256=E3YyxzPDXHv8aFjIqZ8NgokZbkVqOaNM5_ERQAjC6PE,1470
143
142
  together/types/audio/__init__.py,sha256=FRPjWqhXrrSZgg615cnF6cWNqEowSovw__2V7BR3kgo,654
144
143
  together/types/audio/speech_create_params.py,sha256=SwoTcRMG5NnO_LpT3eAXFfOqqxyFh6C-cU8mtY2v4lk,2867
145
- together/types/audio/transcription_create_params.py,sha256=pKjDwN2DUcJG3yVjfw-WmZ68PURwxojJqem3p_5-rJU,1788
144
+ together/types/audio/transcription_create_params.py,sha256=utzevQa2y_fiznVYVIUK7J76HzH_YWgLsvtbtFIH_Gs,2156
146
145
  together/types/audio/transcription_create_response.py,sha256=z8_pzJlzYjP4QxJhwbKuDgAeVpWbgee6jt3QLFVVSjM,3059
147
146
  together/types/audio/translation_create_params.py,sha256=RjKaaR2RNSE4DxuBHCBKDURxxqalZJmApIhtmDV7MBM,1140
148
147
  together/types/audio/translation_create_response.py,sha256=T6SUCExVMin1qSGamHuiWGWS84MZ92tZPBHD7NYm4IU,1843
@@ -158,8 +157,8 @@ together/types/chat/chat_completion_warning.py,sha256=_Dp7YKlxyY2HeZopTvT-Go7qqK
158
157
  together/types/chat/completion_create_params.py,sha256=xPv9X0dtBuPt9wnDm7wlncgGjGZJGkK8P6sFIGhc6WY,10954
159
158
  together/types/code_interpreter/__init__.py,sha256=dAXfb3ryLMtcBalCfxxNu2wJVswVP8G1xXryZnahPQY,201
160
159
  together/types/code_interpreter/session_list_response.py,sha256=TRxLGFTmIY-KLpStKjJtsrm4EI6BBvakpx43B6pkhnw,662
161
- together-2.0.0a7.dist-info/METADATA,sha256=HzZyUH2AwPzifwR9EdqiKMNwK2a9ql8jDA-ZnSBCxFw,21442
162
- together-2.0.0a7.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
163
- together-2.0.0a7.dist-info/entry_points.txt,sha256=4f4RAX89wQkx3AnfHXiGrKyg2fCPnwMd2UdPX48OczA,55
164
- together-2.0.0a7.dist-info/licenses/LICENSE,sha256=5I5MO2DiiBFcD_p4ZF2T4GDb-WeBMD591ALtADdtXDc,11338
165
- together-2.0.0a7.dist-info/RECORD,,
160
+ together-2.0.0a9.dist-info/METADATA,sha256=9tkQfrZfh5J-etaBCQFnsx7JIy6lCw8xAEsBfhr7F-M,20276
161
+ together-2.0.0a9.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
162
+ together-2.0.0a9.dist-info/entry_points.txt,sha256=4f4RAX89wQkx3AnfHXiGrKyg2fCPnwMd2UdPX48OczA,55
163
+ together-2.0.0a9.dist-info/licenses/LICENSE,sha256=5I5MO2DiiBFcD_p4ZF2T4GDb-WeBMD591ALtADdtXDc,11338
164
+ together-2.0.0a9.dist-info/RECORD,,
@@ -1,10 +0,0 @@
1
- # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
-
3
- from .._models import BaseModel
4
-
5
- __all__ = ["VideoCreateResponse"]
6
-
7
-
8
- class VideoCreateResponse(BaseModel):
9
- id: str
10
- """Unique identifier for the video job."""