together 1.2.11__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.
Files changed (201) hide show
  1. together/__init__.py +101 -63
  2. together/_base_client.py +1995 -0
  3. together/_client.py +1033 -0
  4. together/_compat.py +219 -0
  5. together/_constants.py +14 -0
  6. together/_exceptions.py +108 -0
  7. together/_files.py +123 -0
  8. together/_models.py +857 -0
  9. together/_qs.py +150 -0
  10. together/_resource.py +43 -0
  11. together/_response.py +830 -0
  12. together/_streaming.py +370 -0
  13. together/_types.py +260 -0
  14. together/_utils/__init__.py +64 -0
  15. together/_utils/_compat.py +45 -0
  16. together/_utils/_datetime_parse.py +136 -0
  17. together/_utils/_logs.py +25 -0
  18. together/_utils/_proxy.py +65 -0
  19. together/_utils/_reflection.py +42 -0
  20. together/_utils/_resources_proxy.py +24 -0
  21. together/_utils/_streams.py +12 -0
  22. together/_utils/_sync.py +58 -0
  23. together/_utils/_transform.py +457 -0
  24. together/_utils/_typing.py +156 -0
  25. together/_utils/_utils.py +421 -0
  26. together/_version.py +4 -0
  27. together/lib/.keep +4 -0
  28. together/lib/__init__.py +23 -0
  29. together/lib/cli/api/endpoints.py +467 -0
  30. together/lib/cli/api/evals.py +588 -0
  31. together/{cli → lib/cli}/api/files.py +20 -17
  32. together/lib/cli/api/fine_tuning.py +566 -0
  33. together/lib/cli/api/models.py +140 -0
  34. together/lib/cli/api/utils.py +50 -0
  35. together/{cli → lib/cli}/cli.py +17 -23
  36. together/lib/constants.py +61 -0
  37. together/lib/resources/__init__.py +11 -0
  38. together/lib/resources/files.py +999 -0
  39. together/lib/resources/fine_tuning.py +280 -0
  40. together/lib/resources/models.py +35 -0
  41. together/lib/types/__init__.py +13 -0
  42. together/lib/types/error.py +9 -0
  43. together/lib/types/fine_tuning.py +455 -0
  44. together/{utils → lib/utils}/__init__.py +7 -10
  45. together/{utils → lib/utils}/_log.py +18 -13
  46. together/lib/utils/files.py +628 -0
  47. together/lib/utils/serializer.py +10 -0
  48. together/{utils → lib/utils}/tools.py +17 -2
  49. together/resources/__init__.py +225 -24
  50. together/resources/audio/__init__.py +75 -0
  51. together/resources/audio/audio.py +198 -0
  52. together/resources/audio/speech.py +605 -0
  53. together/resources/audio/transcriptions.py +282 -0
  54. together/resources/audio/translations.py +256 -0
  55. together/resources/audio/voices.py +135 -0
  56. together/resources/batches.py +417 -0
  57. together/resources/chat/__init__.py +30 -21
  58. together/resources/chat/chat.py +102 -0
  59. together/resources/chat/completions.py +1063 -257
  60. together/resources/code_interpreter/__init__.py +33 -0
  61. together/resources/code_interpreter/code_interpreter.py +258 -0
  62. together/resources/code_interpreter/sessions.py +135 -0
  63. together/resources/completions.py +890 -225
  64. together/resources/embeddings.py +172 -68
  65. together/resources/endpoints.py +711 -0
  66. together/resources/evals.py +452 -0
  67. together/resources/files.py +397 -120
  68. together/resources/fine_tuning.py +1033 -0
  69. together/resources/hardware.py +181 -0
  70. together/resources/images.py +256 -108
  71. together/resources/jobs.py +214 -0
  72. together/resources/models.py +251 -44
  73. together/resources/rerank.py +190 -92
  74. together/resources/videos.py +374 -0
  75. together/types/__init__.py +66 -73
  76. together/types/audio/__init__.py +10 -0
  77. together/types/audio/speech_create_params.py +75 -0
  78. together/types/audio/transcription_create_params.py +54 -0
  79. together/types/audio/transcription_create_response.py +111 -0
  80. together/types/audio/translation_create_params.py +40 -0
  81. together/types/audio/translation_create_response.py +70 -0
  82. together/types/audio/voice_list_response.py +23 -0
  83. together/types/audio_speech_stream_chunk.py +16 -0
  84. together/types/autoscaling.py +13 -0
  85. together/types/autoscaling_param.py +15 -0
  86. together/types/batch_create_params.py +24 -0
  87. together/types/batch_create_response.py +14 -0
  88. together/types/batch_job.py +45 -0
  89. together/types/batch_list_response.py +10 -0
  90. together/types/chat/__init__.py +18 -0
  91. together/types/chat/chat_completion.py +60 -0
  92. together/types/chat/chat_completion_chunk.py +61 -0
  93. together/types/chat/chat_completion_structured_message_image_url_param.py +18 -0
  94. together/types/chat/chat_completion_structured_message_text_param.py +13 -0
  95. together/types/chat/chat_completion_structured_message_video_url_param.py +18 -0
  96. together/types/chat/chat_completion_usage.py +13 -0
  97. together/types/chat/chat_completion_warning.py +9 -0
  98. together/types/chat/completion_create_params.py +329 -0
  99. together/types/code_interpreter/__init__.py +5 -0
  100. together/types/code_interpreter/session_list_response.py +31 -0
  101. together/types/code_interpreter_execute_params.py +45 -0
  102. together/types/completion.py +42 -0
  103. together/types/completion_chunk.py +66 -0
  104. together/types/completion_create_params.py +138 -0
  105. together/types/dedicated_endpoint.py +44 -0
  106. together/types/embedding.py +24 -0
  107. together/types/embedding_create_params.py +31 -0
  108. together/types/endpoint_create_params.py +43 -0
  109. together/types/endpoint_list_avzones_response.py +11 -0
  110. together/types/endpoint_list_params.py +18 -0
  111. together/types/endpoint_list_response.py +41 -0
  112. together/types/endpoint_update_params.py +27 -0
  113. together/types/eval_create_params.py +263 -0
  114. together/types/eval_create_response.py +16 -0
  115. together/types/eval_list_params.py +21 -0
  116. together/types/eval_list_response.py +10 -0
  117. together/types/eval_status_response.py +100 -0
  118. together/types/evaluation_job.py +139 -0
  119. together/types/execute_response.py +108 -0
  120. together/types/file_delete_response.py +13 -0
  121. together/types/file_list.py +12 -0
  122. together/types/file_purpose.py +9 -0
  123. together/types/file_response.py +31 -0
  124. together/types/file_type.py +7 -0
  125. together/types/fine_tuning_cancel_response.py +194 -0
  126. together/types/fine_tuning_content_params.py +24 -0
  127. together/types/fine_tuning_delete_params.py +11 -0
  128. together/types/fine_tuning_delete_response.py +12 -0
  129. together/types/fine_tuning_list_checkpoints_response.py +21 -0
  130. together/types/fine_tuning_list_events_response.py +12 -0
  131. together/types/fine_tuning_list_response.py +199 -0
  132. together/types/finetune_event.py +41 -0
  133. together/types/finetune_event_type.py +33 -0
  134. together/types/finetune_response.py +177 -0
  135. together/types/hardware_list_params.py +16 -0
  136. together/types/hardware_list_response.py +58 -0
  137. together/types/image_data_b64.py +15 -0
  138. together/types/image_data_url.py +15 -0
  139. together/types/image_file.py +23 -0
  140. together/types/image_generate_params.py +85 -0
  141. together/types/job_list_response.py +47 -0
  142. together/types/job_retrieve_response.py +43 -0
  143. together/types/log_probs.py +18 -0
  144. together/types/model_list_response.py +10 -0
  145. together/types/model_object.py +42 -0
  146. together/types/model_upload_params.py +36 -0
  147. together/types/model_upload_response.py +23 -0
  148. together/types/rerank_create_params.py +36 -0
  149. together/types/rerank_create_response.py +36 -0
  150. together/types/tool_choice.py +23 -0
  151. together/types/tool_choice_param.py +23 -0
  152. together/types/tools_param.py +23 -0
  153. together/types/training_method_dpo.py +22 -0
  154. together/types/training_method_sft.py +18 -0
  155. together/types/video_create_params.py +86 -0
  156. together/types/video_job.py +57 -0
  157. together-2.0.0a8.dist-info/METADATA +680 -0
  158. together-2.0.0a8.dist-info/RECORD +164 -0
  159. {together-1.2.11.dist-info → together-2.0.0a8.dist-info}/WHEEL +1 -1
  160. together-2.0.0a8.dist-info/entry_points.txt +2 -0
  161. {together-1.2.11.dist-info → together-2.0.0a8.dist-info/licenses}/LICENSE +1 -1
  162. together/abstract/api_requestor.py +0 -723
  163. together/cli/api/chat.py +0 -276
  164. together/cli/api/completions.py +0 -119
  165. together/cli/api/finetune.py +0 -272
  166. together/cli/api/images.py +0 -82
  167. together/cli/api/models.py +0 -42
  168. together/client.py +0 -157
  169. together/constants.py +0 -31
  170. together/error.py +0 -191
  171. together/filemanager.py +0 -388
  172. together/legacy/__init__.py +0 -0
  173. together/legacy/base.py +0 -27
  174. together/legacy/complete.py +0 -93
  175. together/legacy/embeddings.py +0 -27
  176. together/legacy/files.py +0 -146
  177. together/legacy/finetune.py +0 -177
  178. together/legacy/images.py +0 -27
  179. together/legacy/models.py +0 -44
  180. together/resources/finetune.py +0 -489
  181. together/together_response.py +0 -50
  182. together/types/abstract.py +0 -26
  183. together/types/chat_completions.py +0 -171
  184. together/types/common.py +0 -65
  185. together/types/completions.py +0 -104
  186. together/types/embeddings.py +0 -35
  187. together/types/error.py +0 -16
  188. together/types/files.py +0 -89
  189. together/types/finetune.py +0 -265
  190. together/types/images.py +0 -42
  191. together/types/models.py +0 -44
  192. together/types/rerank.py +0 -43
  193. together/utils/api_helpers.py +0 -84
  194. together/utils/files.py +0 -204
  195. together/version.py +0 -6
  196. together-1.2.11.dist-info/METADATA +0 -408
  197. together-1.2.11.dist-info/RECORD +0 -58
  198. together-1.2.11.dist-info/entry_points.txt +0 -3
  199. /together/{abstract → lib/cli}/__init__.py +0 -0
  200. /together/{cli → lib/cli/api}/__init__.py +0 -0
  201. /together/{cli/api/__init__.py → py.typed} +0 -0
@@ -1,171 +0,0 @@
1
- from __future__ import annotations
2
-
3
- import warnings
4
- from enum import Enum
5
- from typing import Any, Dict, List
6
-
7
- from pydantic import model_validator
8
- from typing_extensions import Self
9
-
10
- from together.types.abstract import BaseModel
11
- from together.types.common import (
12
- DeltaContent,
13
- FinishReason,
14
- LogprobsPart,
15
- ObjectType,
16
- PromptPart,
17
- UsageData,
18
- )
19
-
20
-
21
- class MessageRole(str, Enum):
22
- ASSISTANT = "assistant"
23
- SYSTEM = "system"
24
- USER = "user"
25
- TOOL = "tool"
26
-
27
-
28
- class ResponseFormatType(str, Enum):
29
- JSON_OBJECT = "json_object"
30
-
31
-
32
- class FunctionCall(BaseModel):
33
- name: str | None = None
34
- arguments: str | None = None
35
-
36
-
37
- class ToolCalls(BaseModel):
38
- id: str | None = None
39
- type: str | None = None
40
- function: FunctionCall | None = None
41
-
42
-
43
- class ChatCompletionMessage(BaseModel):
44
- role: MessageRole
45
- content: str | None = None
46
- tool_calls: List[ToolCalls] | None = None
47
-
48
-
49
- class ResponseFormat(BaseModel):
50
- type: ResponseFormatType
51
- schema_: Dict[str, Any] | None = None
52
-
53
- def to_dict(self) -> Dict[str, Any]:
54
- return {"schema": self.schema_, "type": self.type}
55
-
56
-
57
- class FunctionTool(BaseModel):
58
- description: str | None = None
59
- name: str
60
- parameters: Dict[str, Any] | None = None
61
-
62
-
63
- class FunctionToolChoice(BaseModel):
64
- name: str
65
-
66
-
67
- class Tools(BaseModel):
68
- type: str
69
- function: FunctionTool
70
-
71
-
72
- class ToolChoice(BaseModel):
73
- type: str
74
- function: FunctionToolChoice
75
-
76
-
77
- class ToolChoiceEnum(str, Enum):
78
- Auto = "auto"
79
-
80
-
81
- class ChatCompletionRequest(BaseModel):
82
- # list of messages
83
- messages: List[ChatCompletionMessage]
84
- # model name
85
- model: str
86
- # stopping criteria: max tokens to generate
87
- max_tokens: int | None = None
88
- # stopping criteria: list of strings to stop generation
89
- stop: List[str] | None = None
90
- # sampling hyperparameters
91
- temperature: float | None = None
92
- top_p: float | None = None
93
- top_k: int | None = None
94
- repetition_penalty: float | None = None
95
- presence_penalty: float | None = None
96
- frequency_penalty: float | None = None
97
- min_p: float | None = None
98
- logit_bias: Dict[str, float] | None = None
99
- # stream SSE token chunks
100
- stream: bool = False
101
- # return logprobs
102
- logprobs: int | None = None
103
- # echo prompt.
104
- # can be used with logprobs to return prompt logprobs
105
- echo: bool | None = None
106
- # number of output generations
107
- n: int | None = None
108
- # moderation model
109
- safety_model: str | None = None
110
- # constraints
111
- response_format: ResponseFormat | None = None
112
- tools: List[Tools] | None = None
113
- tool_choice: ToolChoice | ToolChoiceEnum | None = None
114
-
115
- # Raise warning if repetition_penalty is used with presence_penalty or frequency_penalty
116
- @model_validator(mode="after")
117
- def verify_parameters(self) -> Self:
118
- if self.repetition_penalty:
119
- if self.presence_penalty or self.frequency_penalty:
120
- warnings.warn(
121
- "repetition_penalty is not advisable to be used alongside presence_penalty or frequency_penalty"
122
- )
123
- return self
124
-
125
-
126
- class ChatCompletionChoicesData(BaseModel):
127
- index: int | None = None
128
- logprobs: LogprobsPart | None = None
129
- finish_reason: FinishReason | None = None
130
- message: ChatCompletionMessage | None = None
131
-
132
-
133
- class ChatCompletionResponse(BaseModel):
134
- # request id
135
- id: str | None = None
136
- # object type
137
- object: ObjectType | None = None
138
- # created timestamp
139
- created: int | None = None
140
- # model name
141
- model: str | None = None
142
- # choices list
143
- choices: List[ChatCompletionChoicesData] | None = None
144
- # prompt list
145
- prompt: List[PromptPart] | List[None] | None = None
146
- # token usage data
147
- usage: UsageData | None = None
148
-
149
-
150
- class ChatCompletionChoicesChunk(BaseModel):
151
- index: int | None = None
152
- logprobs: float | None = None
153
- finish_reason: FinishReason | None = None
154
- delta: DeltaContent | None = None
155
-
156
-
157
- class ChatCompletionChunk(BaseModel):
158
- # request id
159
- id: str | None = None
160
- # object type
161
- object: ObjectType | None = None
162
- # created timestamp
163
- created: int | None = None
164
- # model name
165
- model: str | None = None
166
- # delta content
167
- choices: List[ChatCompletionChoicesChunk] | None = None
168
- # finish reason
169
- finish_reason: FinishReason | None = None
170
- # token usage data
171
- usage: UsageData | None = None
together/types/common.py DELETED
@@ -1,65 +0,0 @@
1
- from __future__ import annotations
2
-
3
- from enum import Enum
4
- from typing import Any, Dict, List
5
-
6
- from pydantic import ConfigDict
7
- from tqdm.utils import CallbackIOWrapper
8
-
9
- from together.types.abstract import BaseModel
10
-
11
-
12
- # Generation finish reason
13
- class FinishReason(str, Enum):
14
- Length = "length"
15
- StopSequence = "stop"
16
- EOS = "eos"
17
- ToolCalls = "tool_calls"
18
- Error = "error"
19
-
20
-
21
- class UsageData(BaseModel):
22
- prompt_tokens: int
23
- completion_tokens: int
24
- total_tokens: int
25
-
26
-
27
- class ObjectType(str, Enum):
28
- Completion = "text.completion"
29
- CompletionChunk = "completion.chunk"
30
- ChatCompletion = "chat.completion"
31
- ChatCompletionChunk = "chat.completion.chunk"
32
- Embedding = "embedding"
33
- FinetuneEvent = "fine-tune-event"
34
- File = "file"
35
- Model = "model"
36
-
37
-
38
- class LogprobsPart(BaseModel):
39
- # token list
40
- tokens: List[str | None] | None = None
41
- # token logprob list
42
- token_logprobs: List[float | None] | None = None
43
-
44
-
45
- class PromptPart(BaseModel):
46
- # prompt string
47
- text: str | None = None
48
- # list of prompt logprobs
49
- logprobs: LogprobsPart | None = None
50
-
51
-
52
- class DeltaContent(BaseModel):
53
- content: str | None = None
54
-
55
-
56
- class TogetherRequest(BaseModel):
57
- model_config = ConfigDict(arbitrary_types_allowed=True)
58
-
59
- method: str
60
- url: str
61
- headers: Dict[str, str] | None = None
62
- params: Dict[str, Any] | CallbackIOWrapper | None = None
63
- files: Dict[str, Any] | None = None
64
- allow_redirects: bool = True
65
- override_headers: bool = False
@@ -1,104 +0,0 @@
1
- from __future__ import annotations
2
-
3
- import warnings
4
- from typing import Dict, List
5
-
6
- from pydantic import model_validator
7
- from typing_extensions import Self
8
-
9
- from together.types.abstract import BaseModel
10
- from together.types.common import (
11
- DeltaContent,
12
- FinishReason,
13
- LogprobsPart,
14
- ObjectType,
15
- PromptPart,
16
- UsageData,
17
- )
18
-
19
-
20
- class CompletionRequest(BaseModel):
21
- # prompt to complete
22
- prompt: str
23
- # query model
24
- model: str
25
- # stopping criteria: max tokens to generate
26
- max_tokens: int | None = None
27
- # stopping criteria: list of strings to stop generation
28
- stop: List[str] | None = None
29
- # sampling hyperparameters
30
- temperature: float | None = None
31
- top_p: float | None = None
32
- top_k: int | None = None
33
- repetition_penalty: float | None = None
34
- presence_penalty: float | None = None
35
- frequency_penalty: float | None = None
36
- min_p: float | None = None
37
- logit_bias: Dict[str, float] | None = None
38
- # stream SSE token chunks
39
- stream: bool = False
40
- # return logprobs
41
- logprobs: int | None = None
42
- # echo prompt.
43
- # can be used with logprobs to return prompt logprobs
44
- echo: bool | None = None
45
- # number of output generations
46
- n: int | None = None
47
- # moderation model
48
- safety_model: str | None = None
49
-
50
- # Raise warning if repetition_penalty is used with presence_penalty or frequency_penalty
51
- @model_validator(mode="after")
52
- def verify_parameters(self) -> Self:
53
- if self.repetition_penalty:
54
- if self.presence_penalty or self.frequency_penalty:
55
- warnings.warn(
56
- "repetition_penalty is not advisable to be used alongside presence_penalty or frequency_penalty"
57
- )
58
- return self
59
-
60
-
61
- class CompletionChoicesData(BaseModel):
62
- index: int
63
- logprobs: LogprobsPart | None = None
64
- finish_reason: FinishReason | None = None
65
- text: str
66
-
67
-
68
- class CompletionChoicesChunk(BaseModel):
69
- index: int | None = None
70
- logprobs: float | None = None
71
- finish_reason: FinishReason | None = None
72
- delta: DeltaContent | None = None
73
-
74
-
75
- class CompletionResponse(BaseModel):
76
- # request id
77
- id: str | None = None
78
- # object type
79
- object: ObjectType | None = None
80
- # created timestamp
81
- created: int | None = None
82
- # model name
83
- model: str | None = None
84
- # choices list
85
- choices: List[CompletionChoicesData] | None = None
86
- # prompt list
87
- prompt: List[PromptPart] | None = None
88
- # token usage data
89
- usage: UsageData | None = None
90
-
91
-
92
- class CompletionChunk(BaseModel):
93
- # request id
94
- id: str | None = None
95
- # object type
96
- object: ObjectType | None = None
97
- # created timestamp
98
- created: int | None = None
99
- # model name
100
- model: str | None = None
101
- # choices list
102
- choices: List[CompletionChoicesChunk] | None = None
103
- # token usage data
104
- usage: UsageData | None = None
@@ -1,35 +0,0 @@
1
- from __future__ import annotations
2
-
3
- from typing import List, Literal
4
-
5
- from together.types.abstract import BaseModel
6
- from together.types.common import (
7
- ObjectType,
8
- )
9
-
10
-
11
- class EmbeddingRequest(BaseModel):
12
- # input or list of inputs
13
- input: str | List[str]
14
- # model to query
15
- model: str
16
-
17
-
18
- class EmbeddingChoicesData(BaseModel):
19
- # response index
20
- index: int
21
- # object type
22
- object: ObjectType
23
- # embedding response
24
- embedding: List[float] | None = None
25
-
26
-
27
- class EmbeddingResponse(BaseModel):
28
- # job id
29
- id: str | None = None
30
- # query model
31
- model: str | None = None
32
- # object type
33
- object: Literal["list"] | None = None
34
- # list of embedding choices
35
- data: List[EmbeddingChoicesData] | None = None
together/types/error.py DELETED
@@ -1,16 +0,0 @@
1
- from __future__ import annotations
2
-
3
- from pydantic import Field
4
-
5
- from together.types.abstract import BaseModel
6
-
7
-
8
- class TogetherErrorResponse(BaseModel):
9
- # error message
10
- message: str | None = None
11
- # error type
12
- type_: str | None = Field(None, alias="type")
13
- # param causing error
14
- param: str | None = None
15
- # error code
16
- code: str | None = None
together/types/files.py DELETED
@@ -1,89 +0,0 @@
1
- from __future__ import annotations
2
-
3
- from enum import Enum
4
- from typing import List, Literal
5
-
6
- from pydantic import Field
7
-
8
- from together.types.abstract import BaseModel
9
- from together.types.common import (
10
- ObjectType,
11
- )
12
-
13
-
14
- class FilePurpose(str, Enum):
15
- FineTune = "fine-tune"
16
-
17
-
18
- class FileType(str, Enum):
19
- jsonl = "jsonl"
20
- parquet = "parquet"
21
-
22
-
23
- class FileRequest(BaseModel):
24
- """
25
- Files request type
26
- """
27
-
28
- # training file ID
29
- training_file: str
30
- # base model string
31
- model: str
32
- # number of epochs to train for
33
- n_epochs: int
34
- # training learning rate
35
- learning_rate: float
36
- # number of checkpoints to save
37
- n_checkpoints: int | None = None
38
- # training batch size
39
- batch_size: int | None = None
40
- # up to 40 character suffix for output model name
41
- suffix: str | None = None
42
- # weights & biases api key
43
- wandb_api_key: str | None = None
44
-
45
-
46
- class FileResponse(BaseModel):
47
- """
48
- Files API response type
49
- """
50
-
51
- id: str
52
- object: Literal[ObjectType.File]
53
- # created timestamp
54
- created_at: int | None = None
55
- type: FileType | None = None
56
- purpose: FilePurpose | None = None
57
- filename: str | None = None
58
- # file byte size
59
- bytes: int | None = None
60
- # JSONL line count
61
- line_count: int | None = Field(None, alias="LineCount")
62
- processed: bool | None = Field(None, alias="Processed")
63
-
64
-
65
- class FileList(BaseModel):
66
- # object type
67
- object: Literal["list"] | None = None
68
- # list of fine-tune job objects
69
- data: List[FileResponse] | None = None
70
-
71
-
72
- class FileDeleteResponse(BaseModel):
73
- # file id
74
- id: str
75
- # object type
76
- object: Literal[ObjectType.File]
77
- # is deleted
78
- deleted: bool
79
-
80
-
81
- class FileObject(BaseModel):
82
- # object type
83
- object: Literal["local"] | None = None
84
- # fine-tune job id
85
- id: str | None = None
86
- # local path filename
87
- filename: str | None = None
88
- # size in bytes
89
- size: int | None = None