together 1.1.2__py3-none-any.whl → 1.1.3__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.
@@ -20,6 +20,7 @@ class MessageRole(str, Enum):
20
20
  ASSISTANT = "assistant"
21
21
  SYSTEM = "system"
22
22
  USER = "user"
23
+ TOOL = "tool"
23
24
 
24
25
 
25
26
  class ResponseFormatType(str, Enum):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: together
3
- Version: 1.1.2
3
+ Version: 1.1.3
4
4
  Summary: Python client for Together's Cloud Platform!
5
5
  Home-page: https://github.com/togethercomputer/together-python
6
6
  License: Apache-2.0
@@ -17,7 +17,7 @@ Classifier: Programming Language :: Python :: 3.11
17
17
  Classifier: Programming Language :: Python :: 3.12
18
18
  Requires-Dist: aiohttp (>=3.9.3,<4.0.0)
19
19
  Requires-Dist: click (>=8.1.7,<9.0.0)
20
- Requires-Dist: eval-type-backport (>=0.1.3,<0.2.0)
20
+ Requires-Dist: eval-type-backport (>=0.1.3,<0.3.0)
21
21
  Requires-Dist: filelock (>=3.13.1,<4.0.0)
22
22
  Requires-Dist: numpy (>=1.23.5) ; python_version < "3.12"
23
23
  Requires-Dist: numpy (>=1.26.0) ; python_version >= "3.12"
@@ -32,32 +32,46 @@ Project-URL: Bug Tracker, https://github.com/togethercomputer/together-python/is
32
32
  Project-URL: Repository, https://github.com/togethercomputer/together-python
33
33
  Description-Content-Type: text/markdown
34
34
 
35
- The [Together Python 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.8+ applications with easy to use synchronous and asynchronous clients.
35
+ <div align="center">
36
+ <a href="https://www.together.ai/">
37
+ <img alt="together.ai" height="100px" src="https://assets-global.website-files.com/64f6f2c0e3f4c5a91c1e823a/654693d569494912cfc0c0d4_favicon.svg">
38
+ </a>
39
+ </div>
36
40
 
37
- # Installation
41
+ # Together Python API library
42
+
43
+ [![PyPI version](https://img.shields.io/pypi/v/together.svg)](https://pypi.org/project/together/)
44
+ [![Discord](https://dcbadge.vercel.app/api/server/9Rk6sSeWEG?style=flat&compact=true)](https://discord.com/invite/9Rk6sSeWEG)
45
+ [![Twitter](https://img.shields.io/twitter/url/https/twitter.com/togethercompute.svg?style=social&label=Follow%20%40togethercompute)](https://twitter.com/togethercompute)
46
+
47
+ 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.8+ applications with easy to use synchronous and asynchronous clients.
48
+
49
+
50
+
51
+ ## Installation
38
52
 
39
53
  > 🚧
40
- > The library was rewritten in v1.0.0 released in April of 2024. There were significant changes made.
54
+ > The Library was rewritten in v1.0.0 released in April of 2024. There were significant changes made.
41
55
 
42
- To install Together Python Library from PyPi, simply run:
56
+ To install Together Python Library from PyPI, simply run:
43
57
 
44
58
  ```shell Shell
45
59
  pip install --upgrade together
46
60
  ```
47
61
 
48
- ## Setting up API Key
62
+ ### Setting up API Key
49
63
 
50
64
  > 🚧 You will need to create an account with [Together.ai](https://api.together.xyz/) to obtain a Together API Key.
51
65
 
52
66
  Once logged in to the Together Playground, you can find available API keys in [this settings page](https://api.together.xyz/settings/api-keys).
53
67
 
54
- ### Setting environment variable
68
+ #### Setting environment variable
55
69
 
56
70
  ```shell
57
71
  export TOGETHER_API_KEY=xxxxx
58
72
  ```
59
73
 
60
- ### Using the client
74
+ #### Using the client
61
75
 
62
76
  ```python
63
77
  from together import Together
@@ -65,11 +79,11 @@ from together import Together
65
79
  client = Together(api_key="xxxxx")
66
80
  ```
67
81
 
68
- This library contains both a python library and a CLI. We'll demonstrate how to use both below.
82
+ This repo contains both a Python Library and a CLI. We'll demonstrate how to use both below.
69
83
 
70
- # Usage – Python Client
84
+ ## Usage – Python Client
71
85
 
72
- ## Chat Completions
86
+ ### Chat Completions
73
87
 
74
88
  ```python
75
89
  import os
@@ -84,7 +98,7 @@ response = client.chat.completions.create(
84
98
  print(response.choices[0].message.content)
85
99
  ```
86
100
 
87
- ### Streaming
101
+ #### Streaming
88
102
 
89
103
  ```python
90
104
  import os
@@ -101,7 +115,7 @@ for chunk in stream:
101
115
  print(chunk.choices[0].delta.content or "", end="", flush=True)
102
116
  ```
103
117
 
104
- ### Async usage
118
+ #### Async usage
105
119
 
106
120
  ```python
107
121
  import os, asyncio
@@ -130,7 +144,7 @@ async def async_chat_completion(messages):
130
144
  asyncio.run(async_chat_completion(messages))
131
145
  ```
132
146
 
133
- ## Completions
147
+ ### Completions
134
148
 
135
149
  Completions are for code and language models shown [here](https://docs.together.ai/docs/inference-models). Below, a code model example is shown.
136
150
 
@@ -143,11 +157,12 @@ client = Together(api_key=os.environ.get("TOGETHER_API_KEY"))
143
157
  response = client.completions.create(
144
158
  model="codellama/CodeLlama-34b-Python-hf",
145
159
  prompt="Write a Next.js component with TailwindCSS for a header component.",
160
+ max_tokens=200,
146
161
  )
147
162
  print(response.choices[0].text)
148
163
  ```
149
164
 
150
- ### Streaming
165
+ #### Streaming
151
166
 
152
167
  ```python
153
168
  import os
@@ -164,7 +179,7 @@ for chunk in stream:
164
179
  print(chunk.choices[0].delta.content or "", end="", flush=True)
165
180
  ```
166
181
 
167
- ### Async usage
182
+ #### Async usage
168
183
 
169
184
  ```python
170
185
  import os, asyncio
@@ -193,7 +208,7 @@ async def async_chat_completion(prompts):
193
208
  asyncio.run(async_chat_completion(prompts))
194
209
  ```
195
210
 
196
- ## Image generation
211
+ ### Image generation
197
212
 
198
213
  ```python
199
214
  import os
@@ -210,7 +225,7 @@ response = client.images.generate(
210
225
  print(response.data[0].b64_json)
211
226
  ```
212
227
 
213
- ## Embeddings
228
+ ### Embeddings
214
229
 
215
230
  ```python
216
231
  from typing import List
@@ -229,7 +244,7 @@ embeddings = get_embeddings(input_texts, model='togethercomputer/m2-bert-80M-8k-
229
244
  print(embeddings)
230
245
  ```
231
246
 
232
- ## Files
247
+ ### Files
233
248
 
234
249
  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).
235
250
 
@@ -246,7 +261,7 @@ client.files.retrieve_content(id="file-d0d318cb-b7d9-493a-bd70-1cfe089d3815") #
246
261
  client.files.delete(id="file-d0d318cb-b7d9-493a-bd70-1cfe089d3815") # deletes a file
247
262
  ```
248
263
 
249
- ## Fine-tunes
264
+ ### Fine-tunes
250
265
 
251
266
  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-python).
252
267
 
@@ -273,7 +288,7 @@ client.fine_tuning.list_events(id="ft-c66a5c18-1d6d-43c9-94bd-32d756425b4b") #
273
288
  client.fine_tuning.download(id="ft-c66a5c18-1d6d-43c9-94bd-32d756425b4b") # downloads compressed fine-tuned model or checkpoint to local disk
274
289
  ```
275
290
 
276
- ## Models
291
+ ### Models
277
292
 
278
293
  This lists all the models that Together supports.
279
294
 
@@ -289,9 +304,9 @@ for model in models:
289
304
  print(model)
290
305
  ```
291
306
 
292
- # Usage – CLI
307
+ ## Usage – CLI
293
308
 
294
- ## Chat Completions
309
+ ### Chat Completions
295
310
 
296
311
  ```bash
297
312
  together chat.completions \
@@ -302,7 +317,7 @@ together chat.completions \
302
317
 
303
318
  The Chat Completions CLI enables streaming tokens to stdout by default. To disable streaming, use `--no-stream`.
304
319
 
305
- ## Completions
320
+ ### Completions
306
321
 
307
322
  ```bash
308
323
  together completions \
@@ -314,7 +329,7 @@ together completions \
314
329
 
315
330
  The Completions CLI enables streaming tokens to stdout by default. To disable streaming, use `--no-stream`.
316
331
 
317
- ## Image Generations
332
+ ### Image Generations
318
333
 
319
334
  ```bash
320
335
  together images generate \
@@ -325,7 +340,7 @@ together images generate \
325
340
 
326
341
  The image is opened in the default image viewer by default. To disable this, use `--no-show`.
327
342
 
328
- ## Files
343
+ ### Files
329
344
 
330
345
  ```bash
331
346
  # Help
@@ -350,7 +365,7 @@ together files retrieve-content file-6f50f9d1-5b95-416c-9040-0799b2b4b894
350
365
  together files delete file-6f50f9d1-5b95-416c-9040-0799b2b4b894
351
366
  ```
352
367
 
353
- ## Fine-tuning
368
+ ### Fine-tuning
354
369
 
355
370
  ```bash
356
371
  # Help
@@ -377,7 +392,7 @@ together fine-tuning cancel ft-c66a5c18-1d6d-43c9-94bd-32d756425b4b
377
392
  together fine-tuning download ft-c66a5c18-1d6d-43c9-94bd-32d756425b4b
378
393
  ```
379
394
 
380
- ## Models
395
+ ### Models
381
396
 
382
397
  ```bash
383
398
  # Help
@@ -34,7 +34,7 @@ together/resources/models.py,sha256=2dtHhXAqTDOOpwSbYLzWcKTC0-m2Szlb7LDYvp7Jr4w,
34
34
  together/together_response.py,sha256=MhczUCPem93cjX-A1TOAUrRj3sO-o3SLcEcTsZgVzQI,1319
35
35
  together/types/__init__.py,sha256=K7Gv6hLmobIfqfmijZbZwFrwxK_YKIDR_v94_ElFmVA,1432
36
36
  together/types/abstract.py,sha256=1lFQI_3WjsR_t1128AeKW0aTk6EiM6Gh1J3ZuyLLPao,642
37
- together/types/chat_completions.py,sha256=WoIzd21wXLwen7AIM0Ttq9KFl4GsPOaJs-UMu2Bs110,3630
37
+ together/types/chat_completions.py,sha256=C8ihEuKz2RnO6z4d-iF8GNuVOCqEizRG3mtQDgyZ9hw,3648
38
38
  together/types/common.py,sha256=0evjGduXV_tStd0TkGNwvU4fDjfLGUOuUJz6Vl5KYbs,1491
39
39
  together/types/completions.py,sha256=_ll3jCY7OhEJP9md_x2FrmPNGE4P_Nx44klIQ2BrfEc,2173
40
40
  together/types/embeddings.py,sha256=J7grkYYn7xhqeKaBO2T-8XQRtHhkzYzymovtGdIUK5A,751
@@ -49,8 +49,8 @@ together/utils/api_helpers.py,sha256=RSF7SRhbjHzroMOSWAXscflByM1r1ta_1SpxkAT22iE
49
49
  together/utils/files.py,sha256=gMLthqfP5hKxVAerHMdy7gLXzdfY6lyOXdpW24Y4X3I,7165
50
50
  together/utils/tools.py,sha256=3-lXWP3cBCzOVSZg9tr5zOT1jaVeKAKVWxO2fcXZTh8,1788
51
51
  together/version.py,sha256=p03ivHyE0SyWU4jAnRTBi_sOwywVWoZPU4g2gzRgG-Y,126
52
- together-1.1.2.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
53
- together-1.1.2.dist-info/METADATA,sha256=JZqV7UEk2IUIQcUgM0F8JoepNbXZynUkskqq871B-GA,11114
54
- together-1.1.2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
55
- together-1.1.2.dist-info/entry_points.txt,sha256=G-b5NKW6lUUf1V1fH8IPTBb7jXnK7lhbX9H1zTEJXPs,50
56
- together-1.1.2.dist-info/RECORD,,
52
+ together-1.1.3.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
53
+ together-1.1.3.dist-info/METADATA,sha256=mcQwEs6SMuD_Gt54xWTgiQwfR1Wr8CKNfzWwvJmz4lg,11812
54
+ together-1.1.3.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
55
+ together-1.1.3.dist-info/entry_points.txt,sha256=G-b5NKW6lUUf1V1fH8IPTBb7jXnK7lhbX9H1zTEJXPs,50
56
+ together-1.1.3.dist-info/RECORD,,