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.
Files changed (205) 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/{cli → lib/cli}/api/endpoints.py +108 -75
  30. together/lib/cli/api/evals.py +588 -0
  31. together/{cli → lib/cli}/api/files.py +20 -17
  32. together/{cli/api/finetune.py → lib/cli/api/fine_tuning.py} +161 -120
  33. together/lib/cli/api/models.py +140 -0
  34. together/{cli → lib/cli}/api/utils.py +6 -7
  35. together/{cli → lib/cli}/cli.py +16 -24
  36. together/{constants.py → lib/constants.py} +17 -12
  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 +6 -14
  45. together/{utils → lib/utils}/_log.py +11 -16
  46. together/lib/utils/files.py +628 -0
  47. together/lib/utils/serializer.py +10 -0
  48. together/{utils → lib/utils}/tools.py +19 -55
  49. together/resources/__init__.py +225 -33
  50. together/resources/audio/__init__.py +72 -21
  51. together/resources/audio/audio.py +198 -0
  52. together/resources/audio/speech.py +574 -122
  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 -263
  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 +884 -225
  64. together/resources/embeddings.py +172 -68
  65. together/resources/endpoints.py +598 -395
  66. together/resources/evals.py +452 -0
  67. together/resources/files.py +398 -121
  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 +238 -90
  73. together/resources/rerank.py +190 -92
  74. together/resources/videos.py +374 -0
  75. together/types/__init__.py +65 -109
  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.5.17.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.5.17.dist-info → together-2.0.0a8.dist-info/licenses}/LICENSE +1 -1
  162. together/abstract/api_requestor.py +0 -729
  163. together/cli/api/chat.py +0 -276
  164. together/cli/api/completions.py +0 -119
  165. together/cli/api/images.py +0 -93
  166. together/cli/api/models.py +0 -55
  167. together/client.py +0 -176
  168. together/error.py +0 -194
  169. together/filemanager.py +0 -389
  170. together/legacy/__init__.py +0 -0
  171. together/legacy/base.py +0 -27
  172. together/legacy/complete.py +0 -93
  173. together/legacy/embeddings.py +0 -27
  174. together/legacy/files.py +0 -146
  175. together/legacy/finetune.py +0 -177
  176. together/legacy/images.py +0 -27
  177. together/legacy/models.py +0 -44
  178. together/resources/batch.py +0 -136
  179. together/resources/code_interpreter.py +0 -82
  180. together/resources/finetune.py +0 -1064
  181. together/together_response.py +0 -50
  182. together/types/abstract.py +0 -26
  183. together/types/audio_speech.py +0 -110
  184. together/types/batch.py +0 -53
  185. together/types/chat_completions.py +0 -197
  186. together/types/code_interpreter.py +0 -57
  187. together/types/common.py +0 -66
  188. together/types/completions.py +0 -107
  189. together/types/embeddings.py +0 -35
  190. together/types/endpoints.py +0 -123
  191. together/types/error.py +0 -16
  192. together/types/files.py +0 -90
  193. together/types/finetune.py +0 -398
  194. together/types/images.py +0 -44
  195. together/types/models.py +0 -45
  196. together/types/rerank.py +0 -43
  197. together/utils/api_helpers.py +0 -124
  198. together/utils/files.py +0 -425
  199. together/version.py +0 -6
  200. together-1.5.17.dist-info/METADATA +0 -525
  201. together-1.5.17.dist-info/RECORD +0 -69
  202. together-1.5.17.dist-info/entry_points.txt +0 -3
  203. /together/{abstract → lib/cli}/__init__.py +0 -0
  204. /together/{cli → lib/cli/api}/__init__.py +0 -0
  205. /together/{cli/api/__init__.py → py.typed} +0 -0
@@ -1,525 +0,0 @@
1
- Metadata-Version: 2.3
2
- Name: together
3
- Version: 1.5.17
4
- Summary: Python client for Together's Cloud Platform!
5
- License: Apache-2.0
6
- Author: Together AI
7
- Author-email: support@together.ai
8
- Requires-Python: >=3.10,<4.0
9
- Classifier: License :: OSI Approved :: Apache Software License
10
- Classifier: Operating System :: POSIX :: Linux
11
- Classifier: Programming Language :: Python :: 3
12
- Classifier: Programming Language :: Python :: 3.10
13
- Classifier: Programming Language :: Python :: 3.11
14
- Classifier: Programming Language :: Python :: 3.12
15
- Classifier: Programming Language :: Python :: 3.13
16
- Provides-Extra: pyarrow
17
- Requires-Dist: aiohttp (>=3.9.3,<4.0.0)
18
- Requires-Dist: click (>=8.1.7,<9.0.0)
19
- Requires-Dist: eval-type-backport (>=0.1.3,<0.3.0)
20
- Requires-Dist: filelock (>=3.13.1,<4.0.0)
21
- Requires-Dist: numpy (>=1.23.5) ; python_version < "3.12"
22
- Requires-Dist: numpy (>=1.26.0) ; python_version >= "3.12"
23
- Requires-Dist: pillow (>=11.1.0,<12.0.0)
24
- Requires-Dist: pyarrow (>=10.0.1) ; extra == "pyarrow"
25
- Requires-Dist: pydantic (>=2.6.3,<3.0.0)
26
- Requires-Dist: requests (>=2.31.0,<3.0.0)
27
- Requires-Dist: rich (>=13.8.1,<15.0.0)
28
- Requires-Dist: tabulate (>=0.9.0,<0.10.0)
29
- Requires-Dist: tqdm (>=4.66.2,<5.0.0)
30
- Requires-Dist: typer (>=0.9,<0.16)
31
- Project-URL: Bug Tracker, https://github.com/togethercomputer/together-python/issues
32
- Project-URL: Homepage, https://github.com/togethercomputer/together-python
33
- Project-URL: Repository, https://github.com/togethercomputer/together-python
34
- Description-Content-Type: text/markdown
35
-
36
- <div align="center">
37
- <a href="https://www.together.ai/">
38
- <img alt="together.ai" height="100px" src="https://assets-global.website-files.com/64f6f2c0e3f4c5a91c1e823a/654693d569494912cfc0c0d4_favicon.svg">
39
- </a>
40
- </div>
41
-
42
- # Together Python API library
43
-
44
- [![PyPI version](https://img.shields.io/pypi/v/together.svg)](https://pypi.org/project/together/)
45
- [![Discord](https://dcbadge.vercel.app/api/server/9Rk6sSeWEG?style=flat&compact=true)](https://discord.com/invite/9Rk6sSeWEG)
46
- [![Twitter](https://img.shields.io/twitter/url/https/twitter.com/togethercompute.svg?style=social&label=Follow%20%40togethercompute)](https://twitter.com/togethercompute)
47
-
48
- The [Together Python API Library](https://pypi.org/project/together/) is the official Python client for Together's API platform, providing a convenient way for interacting with the REST APIs and enables easy integrations with Python 3.10+ applications with easy to use synchronous and asynchronous clients.
49
-
50
-
51
-
52
- ## Installation
53
-
54
- > 🚧
55
- > The Library was rewritten in v1.0.0 released in April of 2024. There were significant changes made.
56
-
57
- To install Together Python Library from PyPI, simply run:
58
-
59
- ```shell Shell
60
- pip install --upgrade together
61
- ```
62
-
63
- ### Setting up API Key
64
-
65
- > 🚧 You will need to create an account with [Together.ai](https://api.together.xyz/) to obtain a Together API Key.
66
-
67
- Once logged in to the Together Playground, you can find available API keys in [this settings page](https://api.together.xyz/settings/api-keys).
68
-
69
- #### Setting environment variable
70
-
71
- ```shell
72
- export TOGETHER_API_KEY=xxxxx
73
- ```
74
-
75
- #### Using the client
76
-
77
- ```python
78
- from together import Together
79
-
80
- client = Together(api_key="xxxxx")
81
- ```
82
-
83
- This repo contains both a Python Library and a CLI. We'll demonstrate how to use both below.
84
-
85
- ## Usage – Python Client
86
-
87
- ### Chat Completions
88
-
89
- ```python
90
- from together import Together
91
-
92
- client = Together()
93
-
94
- # Simple text message
95
- response = client.chat.completions.create(
96
- model="meta-llama/Llama-4-Scout-17B-16E-Instruct",
97
- messages=[{"role": "user", "content": "tell me about new york"}],
98
- )
99
- print(response.choices[0].message.content)
100
-
101
- # Multi-modal message with text and image
102
- response = client.chat.completions.create(
103
- model="meta-llama/Llama-3.2-11B-Vision-Instruct-Turbo",
104
- messages=[{
105
- "role": "user",
106
- "content": [
107
- {
108
- "type": "text",
109
- "text": "What's in this image?"
110
- },
111
- {
112
- "type": "image_url",
113
- "image_url": {
114
- "url": "https://huggingface.co/datasets/patrickvonplaten/random_img/resolve/main/yosemite.png"
115
- }
116
- }
117
- ]
118
- }]
119
- )
120
- print(response.choices[0].message.content)
121
-
122
- # Multi-modal message with multiple images
123
- response = client.chat.completions.create(
124
- model="Qwen/Qwen2.5-VL-72B-Instruct",
125
- messages=[{
126
- "role": "user",
127
- "content": [
128
- {
129
- "type": "text",
130
- "text": "Compare these two images."
131
- },
132
- {
133
- "type": "image_url",
134
- "image_url": {
135
- "url": "https://huggingface.co/datasets/patrickvonplaten/random_img/resolve/main/yosemite.png"
136
- }
137
- },
138
- {
139
- "type": "image_url",
140
- "image_url": {
141
- "url": "https://huggingface.co/datasets/patrickvonplaten/random_img/resolve/main/slack.png"
142
- }
143
- }
144
- ]
145
- }]
146
- )
147
- print(response.choices[0].message.content)
148
-
149
- # Multi-modal message with text and video
150
- response = client.chat.completions.create(
151
- model="Qwen/Qwen2.5-VL-72B-Instruct",
152
- messages=[{
153
- "role": "user",
154
- "content": [
155
- {
156
- "type": "text",
157
- "text": "What's happening in this video?"
158
- },
159
- {
160
- "type": "video_url",
161
- "video_url": {
162
- "url": "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerFun.mp4"
163
- }
164
- }
165
- ]
166
- }]
167
- )
168
- print(response.choices[0].message.content)
169
- ```
170
-
171
- The chat completions API supports three types of content:
172
- - Plain text messages using the `content` field directly
173
- - Multi-modal messages with images using `type: "image_url"`
174
- - Multi-modal messages with videos using `type: "video_url"`
175
-
176
- When using multi-modal content, the `content` field becomes an array of content objects, each with its own type and corresponding data.
177
-
178
- #### Streaming
179
-
180
- ```python
181
- import os
182
- from together import Together
183
-
184
- client = Together()
185
- stream = client.chat.completions.create(
186
- model="meta-llama/Llama-4-Scout-17B-16E-Instruct",
187
- messages=[{"role": "user", "content": "tell me about new york"}],
188
- stream=True,
189
- )
190
-
191
- for chunk in stream:
192
- print(chunk.choices[0].delta.content or "", end="", flush=True)
193
- ```
194
-
195
- #### Async usage
196
-
197
- ```python
198
- import asyncio
199
- from together import AsyncTogether
200
-
201
- async_client = AsyncTogether()
202
- messages = [
203
- "What are the top things to do in San Francisco?",
204
- "What country is Paris in?",
205
- ]
206
-
207
- async def async_chat_completion(messages):
208
- async_client = AsyncTogether()
209
- tasks = [
210
- async_client.chat.completions.create(
211
- model="meta-llama/Llama-4-Scout-17B-16E-Instruct",
212
- messages=[{"role": "user", "content": message}],
213
- )
214
- for message in messages
215
- ]
216
- responses = await asyncio.gather(*tasks)
217
-
218
- for response in responses:
219
- print(response.choices[0].message.content)
220
-
221
- asyncio.run(async_chat_completion(messages))
222
- ```
223
-
224
- #### Fetching logprobs
225
-
226
- Logprobs are logarithms of token-level generation probabilities that indicate the likelihood of the generated token based on the previous tokens in the context. Logprobs allow us to estimate the model's confidence in its outputs, which can be used to decide how to optimally consume the model's output (e.g. rejecting low confidence outputs, retrying or ensembling model outputs etc).
227
-
228
- ```python
229
- from together import Together
230
-
231
- client = Together()
232
-
233
- response = client.chat.completions.create(
234
- model="meta-llama/Llama-3.2-3B-Instruct-Turbo",
235
- messages=[{"role": "user", "content": "tell me about new york"}],
236
- logprobs=1
237
- )
238
-
239
- response_lobprobs = response.choices[0].logprobs
240
-
241
- print(dict(zip(response_lobprobs.tokens, response_lobprobs.token_logprobs)))
242
- # {'New': -2.384e-07, ' York': 0.0, ',': 0.0, ' also': -0.20703125, ' known': -0.20214844, ' as': -8.34465e-07, ... }
243
- ```
244
-
245
- More details about using logprobs in Together's API can be found [here](https://docs.together.ai/docs/logprobs).
246
-
247
-
248
- ### Completions
249
-
250
- Completions are for code and language models shown [here](https://docs.together.ai/docs/inference-models). Below, a code model example is shown.
251
-
252
- ```python
253
- from together import Together
254
-
255
- client = Together()
256
-
257
- response = client.completions.create(
258
- model="codellama/CodeLlama-34b-Python-hf",
259
- prompt="Write a Next.js component with TailwindCSS for a header component.",
260
- max_tokens=200,
261
- )
262
- print(response.choices[0].text)
263
- ```
264
-
265
- #### Streaming
266
-
267
- ```python
268
- from together import Together
269
-
270
- client = Together()
271
- stream = client.completions.create(
272
- model="codellama/CodeLlama-34b-Python-hf",
273
- prompt="Write a Next.js component with TailwindCSS for a header component.",
274
- stream=True,
275
- )
276
-
277
- for chunk in stream:
278
- print(chunk.choices[0].delta.content or "", end="", flush=True)
279
- ```
280
-
281
- #### Async usage
282
-
283
- ```python
284
- import asyncio
285
- from together import AsyncTogether
286
-
287
- async_client = AsyncTogether()
288
- prompts = [
289
- "Write a Next.js component with TailwindCSS for a header component.",
290
- "Write a python function for the fibonacci sequence",
291
- ]
292
-
293
- async def async_chat_completion(prompts):
294
- tasks = [
295
- async_client.completions.create(
296
- model="codellama/CodeLlama-34b-Python-hf",
297
- prompt=prompt,
298
- )
299
- for prompt in prompts
300
- ]
301
- responses = await asyncio.gather(*tasks)
302
-
303
- for response in responses:
304
- print(response.choices[0].text)
305
-
306
- asyncio.run(async_chat_completion(prompts))
307
- ```
308
-
309
- ### Image generation
310
-
311
- ```python
312
- from together import Together
313
-
314
- client = Together()
315
-
316
- response = client.images.generate(
317
- prompt="space robots",
318
- model="stabilityai/stable-diffusion-xl-base-1.0",
319
- steps=10,
320
- n=4,
321
- )
322
- print(response.data[0].b64_json)
323
- ```
324
-
325
- ### Embeddings
326
-
327
- ```python
328
- from typing import List
329
- from together import Together
330
-
331
- client = Together()
332
-
333
- def get_embeddings(texts: List[str], model: str) -> List[List[float]]:
334
- texts = [text.replace("\n", " ") for text in texts]
335
- outputs = client.embeddings.create(model=model, input = texts)
336
- return [outputs.data[i].embedding for i in range(len(texts))]
337
-
338
- input_texts = ['Our solar system orbits the Milky Way galaxy at about 515,000 mph']
339
- embeddings = get_embeddings(input_texts, model='togethercomputer/m2-bert-80M-8k-retrieval')
340
-
341
- print(embeddings)
342
- ```
343
-
344
- ### Reranking
345
-
346
- ```python
347
- from typing import List
348
- from together import Together
349
-
350
- client = Together()
351
-
352
- def get_reranked_documents(query: str, documents: List[str], model: str, top_n: int = 3) -> List[str]:
353
- outputs = client.rerank.create(model=model, query=query, documents=documents, top_n=top_n)
354
- # sort by relevance score and returns the original docs
355
- return [documents[i] for i in [x.index for x in sorted(outputs.results, key=lambda x: x.relevance_score, reverse=True)]]
356
-
357
- query = "What is the capital of the United States?"
358
- documents = ["New York","Washington, D.C.", "Los Angeles"]
359
-
360
- reranked_documents = get_reranked_documents(query, documents, model='Salesforce/Llama-Rank-V1', top_n=1)
361
-
362
- print(reranked_documents)
363
- ```
364
-
365
- Read more about Reranking [here](https://docs.together.ai/docs/rerank-overview).
366
-
367
- ### Files
368
-
369
- The files API is used for fine-tuning and allows developers to upload data to fine-tune on. It also has several methods to list all files, retrive files, and delete files. Please refer to our fine-tuning docs [here](https://docs.together.ai/docs/fine-tuning-python).
370
-
371
- ```python
372
- from together import Together
373
-
374
- client = Together()
375
-
376
- client.files.upload(file="somedata.jsonl") # uploads a file
377
- client.files.list() # lists all uploaded files
378
- client.files.retrieve(id="file-d0d318cb-b7d9-493a-bd70-1cfe089d3815") # retrieves a specific file
379
- client.files.retrieve_content(id="file-d0d318cb-b7d9-493a-bd70-1cfe089d3815") # retrieves content of a specific file
380
- client.files.delete(id="file-d0d318cb-b7d9-493a-bd70-1cfe089d3815") # deletes a file
381
- ```
382
-
383
- ### Fine-tunes
384
-
385
- The finetune API is used for fine-tuning and allows developers to create finetuning jobs. It also has several methods to list all jobs, retrive statuses and get checkpoints. Please refer to our fine-tuning docs [here](https://docs.together.ai/docs/fine-tuning-quickstart).
386
-
387
- ```python
388
- from together import Together
389
-
390
- client = Together()
391
-
392
- client.fine_tuning.create(
393
- training_file = 'file-d0d318cb-b7d9-493a-bd70-1cfe089d3815',
394
- model = 'meta-llama/Llama-3.2-3B-Instruct',
395
- n_epochs = 3,
396
- n_checkpoints = 1,
397
- batch_size = "max",
398
- learning_rate = 1e-5,
399
- suffix = 'my-demo-finetune',
400
- wandb_api_key = '1a2b3c4d5e.......',
401
- )
402
- client.fine_tuning.list() # lists all fine-tuned jobs
403
- client.fine_tuning.retrieve(id="ft-c66a5c18-1d6d-43c9-94bd-32d756425b4b") # retrieves information on finetune event
404
- client.fine_tuning.cancel(id="ft-c66a5c18-1d6d-43c9-94bd-32d756425b4b") # Cancels a fine-tuning job
405
- client.fine_tuning.list_events(id="ft-c66a5c18-1d6d-43c9-94bd-32d756425b4b") # Lists events of a fine-tune job
406
- client.fine_tuning.download(id="ft-c66a5c18-1d6d-43c9-94bd-32d756425b4b") # downloads compressed fine-tuned model or checkpoint to local disk
407
- ```
408
-
409
- ### Models
410
-
411
- This lists all the models that Together supports.
412
-
413
- ```python
414
- from together import Together
415
-
416
- client = Together()
417
-
418
- models = client.models.list()
419
-
420
- for model in models:
421
- print(model)
422
- ```
423
-
424
- ## Usage – CLI
425
-
426
- ### Chat Completions
427
-
428
- ```bash
429
- together chat.completions \
430
- --message "system" "You are a helpful assistant named Together" \
431
- --message "user" "What is your name?" \
432
- --model meta-llama/Llama-4-Scout-17B-16E-Instruct
433
- ```
434
-
435
- The Chat Completions CLI enables streaming tokens to stdout by default. To disable streaming, use `--no-stream`.
436
-
437
- ### Completions
438
-
439
- ```bash
440
- together completions \
441
- "Large language models are " \
442
- --model meta-llama/Llama-4-Scout-17B-16E-Instruct \
443
- --max-tokens 512 \
444
- --stop "."
445
- ```
446
-
447
- The Completions CLI enables streaming tokens to stdout by default. To disable streaming, use `--no-stream`.
448
-
449
- ### Image Generations
450
-
451
- ```bash
452
- together images generate \
453
- "space robots" \
454
- --model stabilityai/stable-diffusion-xl-base-1.0 \
455
- --n 4
456
- ```
457
-
458
- The image is opened in the default image viewer by default. To disable this, use `--no-show`.
459
-
460
- ### Files
461
-
462
- ```bash
463
- # Help
464
- together files --help
465
-
466
- # Check file
467
- together files check example.jsonl
468
-
469
- # Upload file
470
- together files upload example.jsonl
471
-
472
- # List files
473
- together files list
474
-
475
- # Retrieve file metadata
476
- together files retrieve file-6f50f9d1-5b95-416c-9040-0799b2b4b894
477
-
478
- # Retrieve file content
479
- together files retrieve-content file-6f50f9d1-5b95-416c-9040-0799b2b4b894
480
-
481
- # Delete remote file
482
- together files delete file-6f50f9d1-5b95-416c-9040-0799b2b4b894
483
- ```
484
-
485
- ### Fine-tuning
486
-
487
- ```bash
488
- # Help
489
- together fine-tuning --help
490
-
491
- # Create fine-tune job
492
- together fine-tuning create \
493
- --model togethercomputer/llama-2-7b-chat \
494
- --training-file file-711d8724-b3e3-4ae2-b516-94841958117d
495
-
496
- # List fine-tune jobs
497
- together fine-tuning list
498
-
499
- # Retrieve fine-tune job details
500
- together fine-tuning retrieve ft-c66a5c18-1d6d-43c9-94bd-32d756425b4b
501
-
502
- # List fine-tune job events
503
- together fine-tuning list-events ft-c66a5c18-1d6d-43c9-94bd-32d756425b4b
504
-
505
- # Cancel running job
506
- together fine-tuning cancel ft-c66a5c18-1d6d-43c9-94bd-32d756425b4b
507
-
508
- # Download fine-tuned model weights
509
- together fine-tuning download ft-c66a5c18-1d6d-43c9-94bd-32d756425b4b
510
- ```
511
-
512
- ### Models
513
-
514
- ```bash
515
- # Help
516
- together models --help
517
-
518
- # List models
519
- together models list
520
- ```
521
-
522
- ## Contributing
523
-
524
- Refer to the [Contributing Guide](CONTRIBUTING.md)
525
-
@@ -1,69 +0,0 @@
1
- together/__init__.py,sha256=B8T7ybZ7D6jJNRTuFDVjOFlImCNag8tNZXpZdXz7xNM,1530
2
- together/abstract/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
- together/abstract/api_requestor.py,sha256=kKVxkJqpd1CQ4t9Ky4kngkvlzZh1xoDN0PBAM8mGW_Q,25948
4
- together/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
- together/cli/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
- together/cli/api/chat.py,sha256=2PHRb-9T-lUEKhUJFtc7SxJv3shCVx40gq_8pzfsewM,9234
7
- together/cli/api/completions.py,sha256=l-Zw5t7hojL3w8xd_mitS2NRB72i5Z0xwkzH0rT5XMc,4263
8
- together/cli/api/endpoints.py,sha256=f6KafWZvRF6n_ThWdr3y9uhE6wPF37PcD45w_EtgXmY,13289
9
- together/cli/api/files.py,sha256=QLYEXRkY8J2Gg1SbTCtzGfoTMvosoeACNK83L_oLubs,3397
10
- together/cli/api/finetune.py,sha256=GyG_syK_ctzSnXgO6RgQy4tHbPtAaB9j-mQmnWJq5cg,17085
11
- together/cli/api/images.py,sha256=GADSeaNUHUVMtWovmccGuKc28IJ9E_v4vAEwYHJhu5o,2645
12
- together/cli/api/models.py,sha256=CXw8B1hqNkadogi58GIXhLg_dTJnvTBaE7Kq1_xQ-10,1423
13
- together/cli/api/utils.py,sha256=IuqYWPnLI38_Bqd7lj8V_SnGdYc59pRmMbQmciS4FsM,1326
14
- together/cli/cli.py,sha256=YCDzbXpC5is0rs2PEkUPrIhYuzdyrihQ8GVR_TlDv5s,2054
15
- together/client.py,sha256=us5aE8hVzKmMCHZz52NcSPXByOsigd2sKbbyqe4x1m0,5861
16
- together/constants.py,sha256=UDJhEylJFmdm4bedBDpvqYXBj5Or3k7z9GWtkRY_dZQ,1526
17
- together/error.py,sha256=HU6247CyzCFjaxL9A0XYbXZ6fY_ebRg0FEYjI4Skogs,5515
18
- together/filemanager.py,sha256=lwNIYm-BAcnUPtyE0Q_8NpRNsxMlQrpIWFVUVJBBz88,11356
19
- together/legacy/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
20
- together/legacy/base.py,sha256=ehrX1SCfRbK5OA83wL1q7-tfF-yuZOUxzjxYfFtdvvQ,727
21
- together/legacy/complete.py,sha256=NRJX-vjnkg4HrgDo9LS3jFfhwfXpeGxcl24dcrLPK3A,2439
22
- together/legacy/embeddings.py,sha256=nyTERjyPLTm7Sc987a9FJt1adnW7gIa7xs2CwXLE9EI,635
23
- together/legacy/files.py,sha256=qmAqMiNTPWb6WvLV5Tsv6kxGRfQ31q7OkHZNFwkw8v0,4082
24
- together/legacy/finetune.py,sha256=XjZ4Dn2hSjMUVm64s6u1bbh9F7r9GbDKp-WLmzyEKRw,5123
25
- together/legacy/images.py,sha256=bJJRs-6C7-NexPyaeyHiYlHOU51yls5-QAiqtO4xrZU,626
26
- together/legacy/models.py,sha256=85ZN9Ids_FjdYNDRv5k7sgrtVWPKPHqkDplORtVUGHg,1087
27
- together/resources/__init__.py,sha256=jZ9O14K7wKb1U0bmIMosa9P3W3xPCJhoEJiaHw8anCc,1078
28
- together/resources/audio/__init__.py,sha256=e7xp0Lkp_nMAHXcuFHS7dLXP_YqTPMMZIilW1TW_sAI,551
29
- together/resources/audio/speech.py,sha256=81ib_gIo-Rxoaipx2Pi9ZsKnOTjeFPwSlBrcUkyX5xk,5211
30
- together/resources/batch.py,sha256=wSJR30CAFjzZ436vjYdXLCT0ahA5E0ud_qHMS5YvZ1M,3750
31
- together/resources/chat/__init__.py,sha256=RsTptdP8MeGjcdIjze896-J27cRvCbUoMft0X2BVlQ8,617
32
- together/resources/chat/completions.py,sha256=jYiNZsWa8RyEacL0VgxWj1egJ857oU4nxIY8uqGHcaU,14459
33
- together/resources/code_interpreter.py,sha256=vbN8Mh5MG6HQvqra7p61leIyfebgbgJTM_q2A_Fylhw,2948
34
- together/resources/completions.py,sha256=5Wa-ZjPCxRcam6CDe7KgGYlTA7yJZMmd5TrRgGCL_ug,11726
35
- together/resources/embeddings.py,sha256=PTvLb82yjG_-iQOyuhsilp77Fr7gZ0o6WD2KeRnKoxs,2675
36
- together/resources/endpoints.py,sha256=NNjp-wyzOotzlscGGrANhOHxQBjHTN8f5kTQTH_CLvE,17177
37
- together/resources/files.py,sha256=y3Ri6UtyAa7fjCJ8_fp26Y2hzzi6Aoo21JKkVgljFl8,5026
38
- together/resources/finetune.py,sha256=1O8JIbtLDY32N6hL88jUQVDEGcXFnl9qJAEREFoEK5k,40407
39
- together/resources/images.py,sha256=LQUjKPaFxWTqOAPnyF1Pp7Rz4NLOYhmoKwshpYiprEM,4923
40
- together/resources/models.py,sha256=qgmAXv61Cq4oLxytenEZBywA8shldDHYxJ_EAu_4JWQ,3864
41
- together/resources/rerank.py,sha256=3Ju_aRSyZ1s_3zCSNZnSnEJErUVmt2xa3M8z1nvejMA,3931
42
- together/together_response.py,sha256=a3dgKMPDrlfKQwxYENfNt2T4l2vSZxRWMixhHSy-q3E,1308
43
- together/types/__init__.py,sha256=_93XstLg1OOWratj_N1bsNN-2aS628uHH3SZj0wszyc,2820
44
- together/types/abstract.py,sha256=1lFQI_3WjsR_t1128AeKW0aTk6EiM6Gh1J3ZuyLLPao,642
45
- together/types/audio_speech.py,sha256=jlj8BZf3dkIDARF1P11fuenVLj4try8Yx4RN-EAkhOU,2609
46
- together/types/batch.py,sha256=FP0RuQ3EDy-FV1bh-biPICvyRS7WqLm38GHz5lzKyXM,1112
47
- together/types/chat_completions.py,sha256=qpBCMXEWtRwW_fmiu6cecm3d4h6mcK8gvr-8JkbAopQ,5104
48
- together/types/code_interpreter.py,sha256=cjF8TKgRkJllHS4i24dWQZBGTRsG557eHSewOiip0Kk,1770
49
- together/types/common.py,sha256=kxZ-N9xtBsGYZBmbIWnZ0rfT3Pn8PFB7sAbp3iv96pw,1525
50
- together/types/completions.py,sha256=o3FR5ixsTUj-a3pmOUzbSQg-hESVhpqrC9UD__VCqr4,2971
51
- together/types/embeddings.py,sha256=J7grkYYn7xhqeKaBO2T-8XQRtHhkzYzymovtGdIUK5A,751
52
- together/types/endpoints.py,sha256=EzNhHOoQ_D9fUdNQtxQPeSWiFzdFLqpNodN0YLmv_h0,4393
53
- together/types/error.py,sha256=OVlCs3cx_2WhZK4JzHT8SQyRIIqKOP1AZQ4y1PydjAE,370
54
- together/types/files.py,sha256=i-Ke57p8Svb1MbMZxu-Fo2zxIc6j-mDO2TLGNwPpGu0,1981
55
- together/types/finetune.py,sha256=6_jXgVVp4OOQXkABh0HKBzGy47H3wYCG2QxtXbdYauw,11079
56
- together/types/images.py,sha256=xnC-FZGdZU30WSFTybfGneWxb-kj0ZGufJsgHtB8j0k,980
57
- together/types/models.py,sha256=nwQIZGHKZpX9I6mK8z56VW70YC6Ry6JGsVa0s99QVxc,1055
58
- together/types/rerank.py,sha256=qZfuXOn7MZ6ly8hpJ_MZ7OU_Bi1-cgYNSB20Wja8Qkk,1061
59
- together/utils/__init__.py,sha256=5fqvj4KT2rHxKSQot2TSyV_HcvkvkGiqAiaYuJwqtm0,786
60
- together/utils/_log.py,sha256=5IYNI-jYzxyIS-pUvhb0vE_Muo3MA7GgBhsu66TKP2w,1951
61
- together/utils/api_helpers.py,sha256=2K0O6qeEQ2zVFvi5NBN5m2kjZJaS3-JfKFecQ7SmGaw,3746
62
- together/utils/files.py,sha256=btWQawwXbNKfPmCtRyObZViG1Xx-IPz45PrAtMXvcy8,16741
63
- together/utils/tools.py,sha256=H2MTJhEqtBllaDvOyZehIO_IVNK3P17rSDeILtJIVag,2964
64
- together/version.py,sha256=p03ivHyE0SyWU4jAnRTBi_sOwywVWoZPU4g2gzRgG-Y,126
65
- together-1.5.17.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
66
- together-1.5.17.dist-info/METADATA,sha256=b_DHVFaWDUPFcPHSminvXGJ3THG4CLZTwXqR8OpW9aY,15497
67
- together-1.5.17.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
68
- together-1.5.17.dist-info/entry_points.txt,sha256=G-b5NKW6lUUf1V1fH8IPTBb7jXnK7lhbX9H1zTEJXPs,50
69
- together-1.5.17.dist-info/RECORD,,
@@ -1,3 +0,0 @@
1
- [console_scripts]
2
- together=together.cli.cli:main
3
-
File without changes
File without changes
File without changes