together 2.0.0a9__py3-none-any.whl → 2.0.0a11__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.
Files changed (40) hide show
  1. together/_base_client.py +8 -2
  2. together/_types.py +3 -2
  3. together/_version.py +1 -1
  4. together/lib/cli/api/fine_tuning.py +76 -5
  5. together/lib/cli/api/models.py +1 -6
  6. together/lib/cli/api/utils.py +97 -8
  7. together/lib/constants.py +3 -0
  8. together/lib/resources/files.py +65 -6
  9. together/lib/resources/fine_tuning.py +41 -2
  10. together/lib/types/fine_tuning.py +19 -0
  11. together/resources/audio/transcriptions.py +6 -4
  12. together/resources/audio/translations.py +6 -4
  13. together/resources/chat/completions.py +48 -0
  14. together/resources/fine_tuning.py +213 -5
  15. together/resources/models.py +41 -5
  16. together/types/__init__.py +3 -0
  17. together/types/audio/transcription_create_params.py +5 -2
  18. together/types/audio/translation_create_params.py +5 -2
  19. together/types/audio/voice_list_response.py +4 -0
  20. together/types/autoscaling.py +2 -0
  21. together/types/autoscaling_param.py +2 -0
  22. together/types/chat/completion_create_params.py +78 -5
  23. together/types/dedicated_endpoint.py +2 -0
  24. together/types/endpoint_list_avzones_response.py +2 -0
  25. together/types/endpoint_list_response.py +2 -0
  26. together/types/execute_response.py +7 -0
  27. together/types/fine_tuning_cancel_response.py +20 -0
  28. together/types/fine_tuning_estimate_price_params.py +98 -0
  29. together/types/fine_tuning_estimate_price_response.py +24 -0
  30. together/types/fine_tuning_list_response.py +20 -0
  31. together/types/finetune_response.py +17 -2
  32. together/types/hardware_list_response.py +8 -0
  33. together/types/model_list_params.py +12 -0
  34. together/types/video_job.py +8 -0
  35. {together-2.0.0a9.dist-info → together-2.0.0a11.dist-info}/METADATA +9 -11
  36. {together-2.0.0a9.dist-info → together-2.0.0a11.dist-info}/RECORD +39 -37
  37. together/lib/resources/models.py +0 -35
  38. {together-2.0.0a9.dist-info → together-2.0.0a11.dist-info}/WHEEL +0 -0
  39. {together-2.0.0a9.dist-info → together-2.0.0a11.dist-info}/entry_points.txt +0 -0
  40. {together-2.0.0a9.dist-info → together-2.0.0a11.dist-info}/licenses/LICENSE +0 -0
@@ -29,6 +29,10 @@ __all__ = [
29
29
  "FunctionCall",
30
30
  "FunctionCallName",
31
31
  "ResponseFormat",
32
+ "ResponseFormatText",
33
+ "ResponseFormatJsonSchema",
34
+ "ResponseFormatJsonSchemaJsonSchema",
35
+ "ResponseFormatJsonObject",
32
36
  "ToolChoice",
33
37
  "CompletionCreateParamsNonStreaming",
34
38
  "CompletionCreateParamsStreaming",
@@ -117,7 +121,16 @@ class CompletionCreateParamsBase(TypedDict, total=False):
117
121
  """
118
122
 
119
123
  response_format: ResponseFormat
120
- """An object specifying the format that the model must output."""
124
+ """An object specifying the format that the model must output.
125
+
126
+ Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured
127
+ Outputs which ensures the model will match your supplied JSON schema. Learn more
128
+ in the [Structured Outputs guide](https://docs.together.ai/docs/json-mode).
129
+
130
+ Setting to `{ "type": "json_object" }` enables the older JSON mode, which
131
+ ensures the message the model generates is valid JSON. Using `json_schema` is
132
+ preferred for models that support it.
133
+ """
121
134
 
122
135
  safety_model: str
123
136
  """The name of the moderation model used to validate tokens.
@@ -297,13 +310,73 @@ class FunctionCallName(TypedDict, total=False):
297
310
  FunctionCall: TypeAlias = Union[Literal["none", "auto"], FunctionCallName]
298
311
 
299
312
 
300
- class ResponseFormat(TypedDict, total=False):
313
+ class ResponseFormatText(TypedDict, total=False):
314
+ """Default response format. Used to generate text responses."""
315
+
316
+ type: Required[Literal["text"]]
317
+ """The type of response format being defined. Always `text`."""
318
+
319
+
320
+ class ResponseFormatJsonSchemaJsonSchema(TypedDict, total=False):
321
+ """Structured Outputs configuration options, including a JSON Schema."""
322
+
323
+ name: Required[str]
324
+ """The name of the response format.
325
+
326
+ Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length
327
+ of 64.
328
+ """
329
+
330
+ description: str
331
+ """
332
+ A description of what the response format is for, used by the model to determine
333
+ how to respond in the format.
334
+ """
335
+
301
336
  schema: Dict[str, object]
302
- """The schema of the response format."""
337
+ """
338
+ The schema for the response format, described as a JSON Schema object. Learn how
339
+ to build JSON schemas [here](https://json-schema.org/).
340
+ """
341
+
342
+ strict: Optional[bool]
343
+ """
344
+ Whether to enable strict schema adherence when generating the output. If set to
345
+ true, the model will always follow the exact schema defined in the `schema`
346
+ field. Only a subset of JSON Schema is supported when `strict` is `true`. To
347
+ learn more, read the
348
+ [Structured Outputs guide](https://docs.together.ai/docs/json-mode).
349
+ """
350
+
351
+
352
+ class ResponseFormatJsonSchema(TypedDict, total=False):
353
+ """JSON Schema response format.
354
+
355
+ Used to generate structured JSON responses.
356
+ Learn more about [Structured Outputs](https://docs.together.ai/docs/json-mode).
357
+ """
358
+
359
+ json_schema: Required[ResponseFormatJsonSchemaJsonSchema]
360
+ """Structured Outputs configuration options, including a JSON Schema."""
361
+
362
+ type: Required[Literal["json_schema"]]
363
+ """The type of response format being defined. Always `json_schema`."""
364
+
365
+
366
+ class ResponseFormatJsonObject(TypedDict, total=False):
367
+ """JSON object response format.
368
+
369
+ An older method of generating JSON responses.
370
+ Using `json_schema` is recommended for models that support it. Note that the
371
+ model will not generate JSON without a system or user message instructing it
372
+ to do so.
373
+ """
374
+
375
+ type: Required[Literal["json_object"]]
376
+ """The type of response format being defined. Always `json_object`."""
303
377
 
304
- type: str
305
- """The type of the response format."""
306
378
 
379
+ ResponseFormat: TypeAlias = Union[ResponseFormatText, ResponseFormatJsonSchema, ResponseFormatJsonObject]
307
380
 
308
381
  ToolChoice: TypeAlias = Union[str, ToolChoiceParam]
309
382
 
@@ -10,6 +10,8 @@ __all__ = ["DedicatedEndpoint"]
10
10
 
11
11
 
12
12
  class DedicatedEndpoint(BaseModel):
13
+ """Details about a dedicated endpoint deployment"""
14
+
13
15
  id: str
14
16
  """Unique identifier for the endpoint"""
15
17
 
@@ -8,4 +8,6 @@ __all__ = ["EndpointListAvzonesResponse"]
8
8
 
9
9
 
10
10
  class EndpointListAvzonesResponse(BaseModel):
11
+ """List of unique availability zones"""
12
+
11
13
  avzones: List[str]
@@ -10,6 +10,8 @@ __all__ = ["EndpointListResponse", "Data"]
10
10
 
11
11
 
12
12
  class Data(BaseModel):
13
+ """Details about an endpoint when listed via the list endpoint"""
14
+
13
15
  id: str
14
16
  """Unique identifier for the endpoint"""
15
17
 
@@ -22,12 +22,19 @@ __all__ = [
22
22
 
23
23
 
24
24
  class SuccessfulExecutionDataOutputStreamOutput(BaseModel):
25
+ """Outputs that were printed to stdout or stderr"""
26
+
25
27
  data: str
26
28
 
27
29
  type: Literal["stdout", "stderr"]
28
30
 
29
31
 
30
32
  class SuccessfulExecutionDataOutputError(BaseModel):
33
+ """Errors and exceptions that occurred.
34
+
35
+ If this output type is present, your code did not execute successfully.
36
+ """
37
+
31
38
  data: str
32
39
 
33
40
  type: Literal["error"]
@@ -15,6 +15,7 @@ __all__ = [
15
15
  "LrSchedulerLrSchedulerArgs",
16
16
  "LrSchedulerLrSchedulerArgsLinearLrSchedulerArgs",
17
17
  "LrSchedulerLrSchedulerArgsCosineLrSchedulerArgs",
18
+ "Progress",
18
19
  "TrainingMethod",
19
20
  "TrainingMethodTrainingMethodSft",
20
21
  "TrainingMethodTrainingMethodDpo",
@@ -43,11 +44,23 @@ LrSchedulerLrSchedulerArgs: TypeAlias = Union[
43
44
 
44
45
 
45
46
  class LrScheduler(BaseModel):
47
+ """Learning rate scheduler configuration"""
48
+
46
49
  lr_scheduler_type: Literal["linear", "cosine"]
47
50
 
48
51
  lr_scheduler_args: Optional[LrSchedulerLrSchedulerArgs] = None
49
52
 
50
53
 
54
+ class Progress(BaseModel):
55
+ """Progress information for the fine-tuning job"""
56
+
57
+ estimate_available: bool
58
+ """Whether time estimate is available"""
59
+
60
+ seconds_remaining: int
61
+ """Estimated time remaining in seconds for the fine-tuning job to next state"""
62
+
63
+
51
64
  class TrainingMethodTrainingMethodSft(BaseModel):
52
65
  method: Literal["sft"]
53
66
 
@@ -95,6 +108,10 @@ TrainingType: TypeAlias = Union[TrainingTypeFullTrainingType, TrainingTypeLoRaTr
95
108
 
96
109
 
97
110
  class FineTuningCancelResponse(BaseModel):
111
+ """
112
+ A truncated version of the fine-tune response, used for POST /fine-tunes, GET /fine-tunes and POST /fine-tunes/{id}/cancel endpoints
113
+ """
114
+
98
115
  id: str
99
116
  """Unique identifier for the fine-tune job"""
100
117
 
@@ -157,6 +174,9 @@ class FineTuningCancelResponse(BaseModel):
157
174
  owner_address: Optional[str] = None
158
175
  """Owner address information"""
159
176
 
177
+ progress: Optional[Progress] = None
178
+ """Progress information for the fine-tuning job"""
179
+
160
180
  suffix: Optional[str] = None
161
181
  """Suffix added to the fine-tuned model name"""
162
182
 
@@ -0,0 +1,98 @@
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, TypeAlias, TypedDict
7
+
8
+ __all__ = [
9
+ "FineTuningEstimatePriceParams",
10
+ "TrainingMethod",
11
+ "TrainingMethodTrainingMethodSft",
12
+ "TrainingMethodTrainingMethodDpo",
13
+ "TrainingType",
14
+ "TrainingTypeFullTrainingType",
15
+ "TrainingTypeLoRaTrainingType",
16
+ ]
17
+
18
+
19
+ class FineTuningEstimatePriceParams(TypedDict, total=False):
20
+ training_file: Required[str]
21
+ """File-ID of a training file uploaded to the Together API"""
22
+
23
+ from_checkpoint: str
24
+ """The checkpoint identifier to continue training from a previous fine-tuning job.
25
+
26
+ Format is `{$JOB_ID}` or `{$OUTPUT_MODEL_NAME}` or `{$JOB_ID}:{$STEP}` or
27
+ `{$OUTPUT_MODEL_NAME}:{$STEP}`. The step value is optional; without it, the
28
+ final checkpoint will be used.
29
+ """
30
+
31
+ model: str
32
+ """Name of the base model to run fine-tune job on"""
33
+
34
+ n_epochs: int
35
+ """
36
+ Number of complete passes through the training dataset (higher values may
37
+ improve results but increase cost and risk of overfitting)
38
+ """
39
+
40
+ n_evals: int
41
+ """Number of evaluations to be run on a given validation set during training"""
42
+
43
+ training_method: TrainingMethod
44
+ """The training method to use.
45
+
46
+ 'sft' for Supervised Fine-Tuning or 'dpo' for Direct Preference Optimization.
47
+ """
48
+
49
+ training_type: TrainingType
50
+
51
+ validation_file: str
52
+ """File-ID of a validation file uploaded to the Together API"""
53
+
54
+
55
+ class TrainingMethodTrainingMethodSft(TypedDict, total=False):
56
+ method: Required[Literal["sft"]]
57
+
58
+ train_on_inputs: Required[Union[bool, Literal["auto"]]]
59
+ """
60
+ Whether to mask the user messages in conversational data or prompts in
61
+ instruction data.
62
+ """
63
+
64
+
65
+ class TrainingMethodTrainingMethodDpo(TypedDict, total=False):
66
+ method: Required[Literal["dpo"]]
67
+
68
+ dpo_beta: float
69
+
70
+ dpo_normalize_logratios_by_length: bool
71
+
72
+ dpo_reference_free: bool
73
+
74
+ rpo_alpha: float
75
+
76
+ simpo_gamma: float
77
+
78
+
79
+ TrainingMethod: TypeAlias = Union[TrainingMethodTrainingMethodSft, TrainingMethodTrainingMethodDpo]
80
+
81
+
82
+ class TrainingTypeFullTrainingType(TypedDict, total=False):
83
+ type: Required[Literal["Full"]]
84
+
85
+
86
+ class TrainingTypeLoRaTrainingType(TypedDict, total=False):
87
+ lora_alpha: Required[int]
88
+
89
+ lora_r: Required[int]
90
+
91
+ type: Required[Literal["Lora"]]
92
+
93
+ lora_dropout: float
94
+
95
+ lora_trainable_modules: str
96
+
97
+
98
+ TrainingType: TypeAlias = Union[TrainingTypeFullTrainingType, TrainingTypeLoRaTrainingType]
@@ -0,0 +1,24 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from typing import Optional
4
+
5
+ from .._models import BaseModel
6
+
7
+ __all__ = ["FineTuningEstimatePriceResponse"]
8
+
9
+
10
+ class FineTuningEstimatePriceResponse(BaseModel):
11
+ allowed_to_proceed: Optional[bool] = None
12
+ """Whether the user is allowed to proceed with the fine-tuning job"""
13
+
14
+ estimated_eval_token_count: Optional[float] = None
15
+ """The estimated number of tokens for evaluation"""
16
+
17
+ estimated_total_price: Optional[float] = None
18
+ """The price of the fine-tuning job"""
19
+
20
+ estimated_train_token_count: Optional[float] = None
21
+ """The estimated number of tokens to be trained"""
22
+
23
+ user_limit: Optional[float] = None
24
+ """The user's credit limit in dollars"""
@@ -16,6 +16,7 @@ __all__ = [
16
16
  "DataLrSchedulerLrSchedulerArgs",
17
17
  "DataLrSchedulerLrSchedulerArgsLinearLrSchedulerArgs",
18
18
  "DataLrSchedulerLrSchedulerArgsCosineLrSchedulerArgs",
19
+ "DataProgress",
19
20
  "DataTrainingMethod",
20
21
  "DataTrainingMethodTrainingMethodSft",
21
22
  "DataTrainingMethodTrainingMethodDpo",
@@ -44,11 +45,23 @@ DataLrSchedulerLrSchedulerArgs: TypeAlias = Union[
44
45
 
45
46
 
46
47
  class DataLrScheduler(BaseModel):
48
+ """Learning rate scheduler configuration"""
49
+
47
50
  lr_scheduler_type: Literal["linear", "cosine"]
48
51
 
49
52
  lr_scheduler_args: Optional[DataLrSchedulerLrSchedulerArgs] = None
50
53
 
51
54
 
55
+ class DataProgress(BaseModel):
56
+ """Progress information for the fine-tuning job"""
57
+
58
+ estimate_available: bool
59
+ """Whether time estimate is available"""
60
+
61
+ seconds_remaining: int
62
+ """Estimated time remaining in seconds for the fine-tuning job to next state"""
63
+
64
+
52
65
  class DataTrainingMethodTrainingMethodSft(BaseModel):
53
66
  method: Literal["sft"]
54
67
 
@@ -96,6 +109,10 @@ DataTrainingType: TypeAlias = Union[DataTrainingTypeFullTrainingType, DataTraini
96
109
 
97
110
 
98
111
  class Data(BaseModel):
112
+ """
113
+ A truncated version of the fine-tune response, used for POST /fine-tunes, GET /fine-tunes and POST /fine-tunes/{id}/cancel endpoints
114
+ """
115
+
99
116
  id: str
100
117
  """Unique identifier for the fine-tune job"""
101
118
 
@@ -158,6 +175,9 @@ class Data(BaseModel):
158
175
  owner_address: Optional[str] = None
159
176
  """Owner address information"""
160
177
 
178
+ progress: Optional[DataProgress] = None
179
+ """Progress information for the fine-tuning job"""
180
+
161
181
  suffix: Optional[str] = None
162
182
  """Suffix added to the fine-tuned model name"""
163
183
 
@@ -1,6 +1,7 @@
1
1
  # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  from typing import List, Union, Optional
4
+ from datetime import datetime
4
5
  from typing_extensions import Literal, TypeAlias
5
6
 
6
7
  from pydantic import Field as FieldInfo
@@ -14,6 +15,7 @@ __all__ = [
14
15
  "LrSchedulerLrSchedulerArgs",
15
16
  "LrSchedulerLrSchedulerArgsLinearLrSchedulerArgs",
16
17
  "LrSchedulerLrSchedulerArgsCosineLrSchedulerArgs",
18
+ "Progress",
17
19
  "TrainingMethod",
18
20
  "TrainingMethodTrainingMethodSft",
19
21
  "TrainingMethodTrainingMethodDpo",
@@ -47,6 +49,16 @@ class LrScheduler(BaseModel):
47
49
  lr_scheduler_args: Optional[LrSchedulerLrSchedulerArgs] = None
48
50
 
49
51
 
52
+ class Progress(BaseModel):
53
+ """Progress information for a fine-tuning job"""
54
+
55
+ estimate_available: bool
56
+ """Whether time estimate is available"""
57
+
58
+ seconds_remaining: int
59
+ """Estimated time remaining in seconds for the fine-tuning job to next state"""
60
+
61
+
50
62
  class TrainingMethodTrainingMethodSft(BaseModel):
51
63
  method: Literal["sft"]
52
64
 
@@ -110,7 +122,7 @@ class FinetuneResponse(BaseModel):
110
122
 
111
123
  batch_size: Union[int, Literal["max"], None] = None
112
124
 
113
- created_at: Optional[str] = None
125
+ created_at: Optional[datetime] = None
114
126
 
115
127
  epochs_completed: Optional[int] = None
116
128
 
@@ -146,6 +158,9 @@ class FinetuneResponse(BaseModel):
146
158
 
147
159
  param_count: Optional[int] = None
148
160
 
161
+ progress: Optional[Progress] = None
162
+ """Progress information for a fine-tuning job"""
163
+
149
164
  queue_depth: Optional[int] = None
150
165
 
151
166
  token_count: Optional[int] = None
@@ -164,7 +179,7 @@ class FinetuneResponse(BaseModel):
164
179
 
165
180
  trainingfile_size: Optional[int] = None
166
181
 
167
- updated_at: Optional[str] = None
182
+ updated_at: Optional[datetime] = None
168
183
 
169
184
  validation_file: Optional[str] = None
170
185
 
@@ -10,11 +10,15 @@ __all__ = ["HardwareListResponse", "Data", "DataPricing", "DataSpecs", "DataAvai
10
10
 
11
11
 
12
12
  class DataPricing(BaseModel):
13
+ """Pricing details for using an endpoint"""
14
+
13
15
  cents_per_minute: float
14
16
  """Cost per minute of endpoint uptime in cents"""
15
17
 
16
18
 
17
19
  class DataSpecs(BaseModel):
20
+ """Detailed specifications of a hardware configuration"""
21
+
18
22
  gpu_count: int
19
23
  """Number of GPUs in this configuration"""
20
24
 
@@ -29,11 +33,15 @@ class DataSpecs(BaseModel):
29
33
 
30
34
 
31
35
  class DataAvailability(BaseModel):
36
+ """Indicates the current availability status of a hardware configuration"""
37
+
32
38
  status: Literal["available", "unavailable", "insufficient"]
33
39
  """The availability status of the hardware configuration"""
34
40
 
35
41
 
36
42
  class Data(BaseModel):
43
+ """Hardware configuration details with optional availability status"""
44
+
37
45
  id: str
38
46
  """Unique identifier for the hardware configuration"""
39
47
 
@@ -0,0 +1,12 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing_extensions import TypedDict
6
+
7
+ __all__ = ["ModelListParams"]
8
+
9
+
10
+ class ModelListParams(TypedDict, total=False):
11
+ dedicated: bool
12
+ """Filter models to only return dedicated models"""
@@ -9,12 +9,18 @@ __all__ = ["VideoJob", "Error", "Outputs"]
9
9
 
10
10
 
11
11
  class Error(BaseModel):
12
+ """Error payload that explains why generation failed, if applicable."""
13
+
12
14
  message: str
13
15
 
14
16
  code: Optional[str] = None
15
17
 
16
18
 
17
19
  class Outputs(BaseModel):
20
+ """
21
+ Available upon completion, the outputs provides the cost charged and the hosted url to access the video
22
+ """
23
+
18
24
  cost: int
19
25
  """The cost of generated video charged to the owners account."""
20
26
 
@@ -23,6 +29,8 @@ class Outputs(BaseModel):
23
29
 
24
30
 
25
31
  class VideoJob(BaseModel):
32
+ """Structured information describing a generated video job."""
33
+
26
34
  id: str
27
35
  """Unique identifier for the video job."""
28
36
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: together
3
- Version: 2.0.0a9
3
+ Version: 2.0.0a11
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
@@ -232,17 +232,15 @@ from together import Together
232
232
 
233
233
  client = Together()
234
234
 
235
- chat_completion = client.chat.completions.create(
236
- messages=[
237
- {
238
- "content": "content",
239
- "role": "system",
240
- }
241
- ],
242
- model="meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo",
243
- response_format={},
235
+ dedicated_endpoint = client.endpoints.create(
236
+ autoscaling={
237
+ "max_replicas": 5,
238
+ "min_replicas": 2,
239
+ },
240
+ hardware="1x_nvidia_a100_80gb_sxm",
241
+ model="meta-llama/Llama-3-8b-chat-hf",
244
242
  )
245
- print(chat_completion.response_format)
243
+ print(dedicated_endpoint.autoscaling)
246
244
  ```
247
245
 
248
246
  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.