Skip to content

Commit b9701a0

Browse files
release: 0.1.0-alpha.13 (#149)
* chore(tests): improve ci test names * Move the files upload into files resource. * Format * Fix circular import * Add async upload support * Remove top level exports of UploadManager, DownloadManager * feat(api): move upload to be a method of existing files resource * feat(api): move upload to be a method of existing files resource * fix(api): correct file reroute handling, error message * chore(docs): remove reference to rye shell * chore(docs): remove unnecessary param examples * feat(client): add follow_redirects request option * feat(api): api update * feat(api): update spec / config to remove remaining codegen warnings * codegen metadata * codegen metadata * chore(tests): run tests in parallel * fix(client): correctly parse binary response | stream * feat(api): api update * chore(tests): add tests for httpx client instantiation & proxies * chore(internal): update conftest.py * chore(ci): enable for pull requests * chore(readme): update badges * fix(tests): fix: tests which call HTTP endpoints directly with the example parameters * docs(client): fix httpx.Timeout documentation reference * chore: change publish docs url * feat(client): add support for aiohttp * feat(api): add batch api to config * release: 0.1.0-alpha.13 --------- Co-authored-by: Justin Driemeyer <[email protected]> Co-authored-by: jdreamerz <[email protected]> Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com>
1 parent e2f33e1 commit b9701a0

39 files changed

+1175
-124
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ on:
77
- 'integrated/**'
88
- 'stl-preview-head/**'
99
- 'stl-preview-base/**'
10+
pull_request:
11+
branches-ignore:
12+
- 'stl-preview-head/**'
13+
- 'stl-preview-base/**'
1014

1115
jobs:
1216
lint:

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "0.1.0-alpha.12"
2+
".": "0.1.0-alpha.13"
33
}

.stats.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 30
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/togetherai%2Ftogetherai-653a4aa26fdd2b335d1ead9c2ea0672cbe48a7616b76bf350a2421a8def4e08d.yml
3-
openapi_spec_hash: 1d5af8ab9d8c11d7f5225e19ebd1654a
4-
config_hash: d15dd709dd3f87b0a8b83b00b4abc881
1+
configured_endpoints: 33
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/togetherai%2Ftogetherai-9ca24c17ccf9b0b4c2d27c09881dc74bf4cb44efc7a5ccb7d54fa15caee095d1.yml
3+
openapi_spec_hash: 306c08678a0677f1deb1d35def6f8713
4+
config_hash: fa59b4c1ab0a2e74aa855e7227b10c7d

CHANGELOG.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,36 @@
11
# Changelog
22

3+
## 0.1.0-alpha.13 (2025-06-20)
4+
5+
Full Changelog: [v0.1.0-alpha.12...v0.1.0-alpha.13](https://github.com/togethercomputer/together-py/compare/v0.1.0-alpha.12...v0.1.0-alpha.13)
6+
7+
### Features
8+
9+
* **api:** add batch api to config ([07299cc](https://github.com/togethercomputer/together-py/commit/07299cc337cb356076643df7fc070b2fd8e85c54))
10+
* **api:** api update ([249669c](https://github.com/togethercomputer/together-py/commit/249669c03db384d71c04fe69f78a579b5235c54c))
11+
* **client:** add support for aiohttp ([8e4cedf](https://github.com/togethercomputer/together-py/commit/8e4cedf646520031811a97f65460f41b61894dd9))
12+
13+
14+
### Bug Fixes
15+
16+
* **client:** correctly parse binary response | stream ([7b9486c](https://github.com/togethercomputer/together-py/commit/7b9486c29ef0eeb862460d1ee82417db9a8f801f))
17+
* **tests:** fix: tests which call HTTP endpoints directly with the example parameters ([82b2dcb](https://github.com/togethercomputer/together-py/commit/82b2dcb43af96a7339b2305d02486d3084850303))
18+
19+
20+
### Chores
21+
22+
* change publish docs url ([8fac9f3](https://github.com/togethercomputer/together-py/commit/8fac9f3e12630ed88b68c6cb7d798ebcc6a88833))
23+
* **ci:** enable for pull requests ([6e4d972](https://github.com/togethercomputer/together-py/commit/6e4d972a3a3094fb2d8d468d1e3e89b173ce6ffd))
24+
* **internal:** update conftest.py ([2b13ac4](https://github.com/togethercomputer/together-py/commit/2b13ac4298cc44c0515a3aa348cfdb4bc63d9cb2))
25+
* **readme:** update badges ([acfabb5](https://github.com/togethercomputer/together-py/commit/acfabb57a60aab2853283f62d72897a8bb95a778))
26+
* **tests:** add tests for httpx client instantiation & proxies ([30ba23e](https://github.com/togethercomputer/together-py/commit/30ba23e549ed87a82a7e49164b1809388486754b))
27+
* **tests:** run tests in parallel ([7efb923](https://github.com/togethercomputer/together-py/commit/7efb923a6802382cdfe676c1124e6b9dafd8e233))
28+
29+
30+
### Documentation
31+
32+
* **client:** fix httpx.Timeout documentation reference ([bed4e88](https://github.com/togethercomputer/together-py/commit/bed4e88653ff35029c1921bd2d940abade5b00c0))
33+
334
## 0.1.0-alpha.12 (2025-06-10)
435

536
Full Changelog: [v0.1.0-alpha.11...v0.1.0-alpha.12](https://github.com/togethercomputer/together-py/compare/v0.1.0-alpha.11...v0.1.0-alpha.12)

README.md

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Together Python API library
22

3-
[![PyPI version](https://img.shields.io/pypi/v/together.svg)](https://pypi.org/project/together/)
3+
[![PyPI version](<https://img.shields.io/pypi/v/together.svg?label=pypi%20(stable)>)](https://pypi.org/project/together/)
44

55
The Together Python library provides convenient access to the Together REST API from any Python 3.8+
66
application. The library includes type definitions for all request params and response fields,
@@ -20,7 +20,7 @@ pip install git+ssh://[email protected]/togethercomputer/together-py.git
2020
```
2121

2222
> [!NOTE]
23-
> Once this package is [published to PyPI](https://app.stainless.com/docs/guides/publish), this will become: `pip install --pre together`
23+
> Once this package is [published to PyPI](https://www.stainless.com/docs/guides/publish), this will become: `pip install --pre together`
2424
2525
## Usage
2626

@@ -83,6 +83,46 @@ asyncio.run(main())
8383

8484
Functionality between the synchronous and asynchronous clients is otherwise identical.
8585

86+
### With aiohttp
87+
88+
By default, the async client uses `httpx` for HTTP requests. However, for improved concurrency performance you may also use `aiohttp` as the HTTP backend.
89+
90+
You can enable this by installing `aiohttp`:
91+
92+
```sh
93+
# install from the production repo
94+
pip install 'together[aiohttp] @ git+ssh://[email protected]/togethercomputer/together-py.git'
95+
```
96+
97+
Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:
98+
99+
```python
100+
import os
101+
import asyncio
102+
from together import DefaultAioHttpClient
103+
from together import AsyncTogether
104+
105+
106+
async def main() -> None:
107+
async with AsyncTogether(
108+
api_key=os.environ.get("TOGETHER_API_KEY"), # This is the default and can be omitted
109+
http_client=DefaultAioHttpClient(),
110+
) as client:
111+
chat_completion = await client.chat.completions.create(
112+
messages=[
113+
{
114+
"role": "user",
115+
"content": "Say this is a test!",
116+
}
117+
],
118+
model="mistralai/Mixtral-8x7B-Instruct-v0.1",
119+
)
120+
print(chat_completion.choices)
121+
122+
123+
asyncio.run(main())
124+
```
125+
86126
## Streaming responses
87127

88128
We provide support for streaming responses using Server Side Events (SSE).
@@ -258,7 +298,7 @@ client.with_options(max_retries=5).chat.completions.create(
258298
### Timeouts
259299

260300
By default requests time out after 1 minute. You can configure this with a `timeout` option,
261-
which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/#fine-tuning-the-configuration) object:
301+
which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/timeouts/#fine-tuning-the-configuration) object:
262302

263303
```python
264304
from together import Together

api.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,3 +220,17 @@ from together.types import HardwareListResponse
220220
Methods:
221221

222222
- <code title="get /hardware">client.hardware.<a href="./src/together/resources/hardware.py">list</a>(\*\*<a href="src/together/types/hardware_list_params.py">params</a>) -> <a href="./src/together/types/hardware_list_response.py">HardwareListResponse</a></code>
223+
224+
# Batches
225+
226+
Types:
227+
228+
```python
229+
from together.types import BatchCreateResponse, BatchRetrieveResponse, BatchListResponse
230+
```
231+
232+
Methods:
233+
234+
- <code title="post /batches">client.batches.<a href="./src/together/resources/batches.py">create</a>(\*\*<a href="src/together/types/batch_create_params.py">params</a>) -> <a href="./src/together/types/batch_create_response.py">BatchCreateResponse</a></code>
235+
- <code title="get /batches/{id}">client.batches.<a href="./src/together/resources/batches.py">retrieve</a>(id) -> <a href="./src/together/types/batch_retrieve_response.py">BatchRetrieveResponse</a></code>
236+
- <code title="get /batches">client.batches.<a href="./src/together/resources/batches.py">list</a>() -> <a href="./src/together/types/batch_list_response.py">BatchListResponse</a></code>

pyproject.toml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "together"
3-
version = "0.1.0-alpha.12"
3+
version = "0.1.0-alpha.13"
44
description = "The official Python library for the together API"
55
dynamic = ["readme"]
66
license = "Apache-2.0"
@@ -45,6 +45,9 @@ classifiers = [
4545
Homepage = "https://github.com/togethercomputer/together-py"
4646
Repository = "https://github.com/togethercomputer/together-py"
4747

48+
[project.optional-dependencies]
49+
aiohttp = ["aiohttp", "httpx_aiohttp>=0.1.6"]
50+
4851
[project.scripts]
4952
together = "together.lib.cli.cli:main"
5053

@@ -64,6 +67,7 @@ dev-dependencies = [
6467
"importlib-metadata>=6.7.0",
6568
"rich>=13.7.1",
6669
"nest_asyncio==1.6.0",
70+
"pytest-xdist>=3.6.1",
6771
"pytest-mock>=3.14.0",
6872
]
6973

@@ -136,7 +140,7 @@ replacement = '[\1](https://github.com/togethercomputer/together-py/tree/main/\g
136140

137141
[tool.pytest.ini_options]
138142
testpaths = ["tests"]
139-
addopts = "--tb=short"
143+
addopts = "--tb=short -n auto"
140144
xfail_strict = true
141145
asyncio_mode = "auto"
142146
asyncio_default_fixture_loop_scope = "session"

requirements-dev.lock

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,24 @@
1010
# universal: false
1111

1212
-e file:.
13+
aiohappyeyeballs==2.6.1
14+
# via aiohttp
15+
aiohttp==3.12.13
16+
# via httpx-aiohttp
17+
# via together
18+
aiosignal==1.3.2
19+
# via aiohttp
1320
annotated-types==0.6.0
1421
# via pydantic
1522
anyio==4.4.0
1623
# via httpx
1724
# via together
1825
argcomplete==3.1.2
1926
# via nox
27+
async-timeout==5.0.1
28+
# via aiohttp
29+
attrs==25.3.0
30+
# via aiohttp
2031
certifi==2023.7.22
2132
# via httpcore
2233
# via httpx
@@ -32,25 +43,37 @@ distro==1.8.0
3243
exceptiongroup==1.2.2
3344
# via anyio
3445
# via pytest
46+
execnet==2.1.1
47+
# via pytest-xdist
3548
filelock==3.12.4
3649
# via virtualenv
50+
frozenlist==1.7.0
51+
# via aiohttp
52+
# via aiosignal
3753
h11==0.14.0
3854
# via httpcore
3955
httpcore==1.0.2
4056
# via httpx
4157
httpx==0.28.1
58+
# via httpx-aiohttp
4259
# via respx
4360
# via together
61+
httpx-aiohttp==0.1.6
62+
# via together
4463
idna==3.4
4564
# via anyio
4665
# via httpx
66+
# via yarl
4767
importlib-metadata==7.0.0
4868
iniconfig==2.0.0
4969
# via pytest
5070
markdown-it-py==3.0.0
5171
# via rich
5272
mdurl==0.1.2
5373
# via markdown-it-py
74+
multidict==6.5.0
75+
# via aiohttp
76+
# via yarl
5477
mypy==1.14.1
5578
mypy-extensions==1.0.0
5679
# via mypy
@@ -69,6 +92,9 @@ platformdirs==3.11.0
6992
# via virtualenv
7093
pluggy==1.5.0
7194
# via pytest
95+
propcache==0.3.2
96+
# via aiohttp
97+
# via yarl
7298
pyarrow==16.1.0
7399
# via together
74100
pyarrow-stubs==10.0.1.7
@@ -83,8 +109,10 @@ pyright==1.1.399
83109
pytest==8.3.3
84110
# via pytest-asyncio
85111
# via pytest-mock
112+
# via pytest-xdist
86113
pytest-asyncio==0.24.0
87114
pytest-mock==3.14.0
115+
pytest-xdist==3.7.0
88116
python-dateutil==2.8.2
89117
# via time-machine
90118
pytz==2023.3.post1
@@ -115,6 +143,7 @@ types-tqdm==4.67.0.20250516
115143
# via together
116144
typing-extensions==4.12.2
117145
# via anyio
146+
# via multidict
118147
# via mypy
119148
# via pydantic
120149
# via pydantic-core
@@ -124,5 +153,7 @@ urllib3==2.4.0
124153
# via types-requests
125154
virtualenv==20.24.5
126155
# via nox
156+
yarl==1.20.1
157+
# via aiohttp
127158
zipp==3.17.0
128159
# via importlib-metadata

requirements.lock

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,22 @@
1010
# universal: false
1111

1212
-e file:.
13+
aiohappyeyeballs==2.6.1
14+
# via aiohttp
15+
aiohttp==3.12.13
16+
# via httpx-aiohttp
17+
# via together
18+
aiosignal==1.3.2
19+
# via aiohttp
1320
annotated-types==0.6.0
1421
# via pydantic
1522
anyio==4.4.0
1623
# via httpx
1724
# via together
25+
async-timeout==5.0.1
26+
# via aiohttp
27+
attrs==25.3.0
28+
# via aiohttp
1829
certifi==2023.7.22
1930
# via httpcore
2031
# via httpx
@@ -24,19 +35,32 @@ distro==1.8.0
2435
# via together
2536
exceptiongroup==1.2.2
2637
# via anyio
38+
frozenlist==1.7.0
39+
# via aiohttp
40+
# via aiosignal
2741
h11==0.14.0
2842
# via httpcore
2943
httpcore==1.0.2
3044
# via httpx
3145
httpx==0.28.1
46+
# via httpx-aiohttp
47+
# via together
48+
httpx-aiohttp==0.1.6
3249
# via together
3350
idna==3.4
3451
# via anyio
3552
# via httpx
53+
# via yarl
54+
multidict==6.5.0
55+
# via aiohttp
56+
# via yarl
3657
numpy==2.0.0
3758
# via pyarrow
3859
pillow==10.4.0
3960
# via together
61+
propcache==0.3.2
62+
# via aiohttp
63+
# via yarl
4064
pyarrow==16.1.0
4165
# via together
4266
pyarrow-stubs==10.0.1.7
@@ -60,8 +84,11 @@ types-tqdm==4.67.0.20250516
6084
# via together
6185
typing-extensions==4.12.2
6286
# via anyio
87+
# via multidict
6388
# via pydantic
6489
# via pydantic-core
6590
# via together
6691
urllib3==2.4.0
6792
# via types-requests
93+
yarl==1.20.1
94+
# via aiohttp

src/together/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
UnprocessableEntityError,
4343
APIResponseValidationError,
4444
)
45-
from ._base_client import DefaultHttpxClient, DefaultAsyncHttpxClient
45+
from ._base_client import DefaultHttpxClient, DefaultAioHttpClient, DefaultAsyncHttpxClient
4646
from ._utils._logs import setup_logging as _setup_logging
4747

4848
__all__ = [
@@ -84,6 +84,7 @@
8484
"DEFAULT_CONNECTION_LIMITS",
8585
"DefaultHttpxClient",
8686
"DefaultAsyncHttpxClient",
87+
"DefaultAioHttpClient",
8788
"create_finetune_request",
8889
"FinetuneTrainingLimits",
8990
"DownloadError",

0 commit comments

Comments
 (0)