Skip to content

Commit 9014305

Browse files
committed
Merge branch 'main' into feat/together-interpreter
2 parents 0613799 + e9df12c commit 9014305

25 files changed

+1191
-211
lines changed

.devcontainer/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM mcr.microsoft.com/devcontainers/python:3.9
1+
FROM mcr.microsoft.com/devcontainers/python:3.10
22

33
ENV PYTHONUNBUFFERED 1
44

.github/workflows/_integration_tests.yml

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,27 @@ name: integration-tests
33
on:
44
push:
55
branches: [ main ]
6-
paths:
7-
- "**.py"
6+
paths-ignore:
7+
- "**.md"
88

99
pull_request:
1010
branches: [ main ]
11-
paths:
12-
- "**.py"
11+
paths-ignore:
12+
- "**.md"
1313

1414
concurrency:
1515
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
1616
cancel-in-progress: true
1717

1818
env:
19-
POETRY_VERSION: "1.7.1"
19+
POETRY_VERSION: "2.1.1"
2020

2121
jobs:
2222
build:
2323
runs-on: ubuntu-latest
2424
strategy:
2525
matrix:
2626
python-version:
27-
- "3.9"
2827
- "3.10"
2928
- "3.11"
3029
- "3.12"
@@ -39,14 +38,10 @@ jobs:
3938
poetry-version: ${{ env.POETRY_VERSION }}
4039
cache-key: core
4140

42-
- name: Install dependencies
41+
- name: Install together with dependencies
4342
shell: bash
4443
run: poetry install --with quality,tests
4544

46-
- name: Install together
47-
run: |
48-
poetry run pip install .
49-
5045
- name: Run integration tests
5146
shell: bash
5247
env:

.github/workflows/_tests.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ name: unit-tests
33
on:
44
push:
55
branches: [ main ]
6-
paths:
7-
- "**.py"
6+
paths-ignore:
7+
- "**.md"
88

99
pull_request:
1010
branches: [ main ]
11-
paths:
12-
- "**.py"
11+
paths-ignore:
12+
- "**.md"
1313

1414
concurrency:
1515
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
@@ -24,7 +24,6 @@ jobs:
2424
strategy:
2525
matrix:
2626
python-version:
27-
- "3.9"
2827
- "3.10"
2928
- "3.11"
3029
- "3.12"

.github/workflows/check_code_quality.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,9 @@ name: pre-commit
33
on:
44
push:
55
branches: [ main ]
6-
paths:
7-
- "**.py"
86

97
pull_request:
108
branches: [ main ]
11-
paths:
12-
- "**.py"
139

1410
concurrency:
1511
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}

.github/workflows/upload-to-pypi.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ on:
44
release:
55
types: [published]
66

7+
env:
8+
POETRY_VERSION: "2.1.1"
9+
710
jobs:
811
build:
912
runs-on: ubuntu-latest
@@ -13,16 +16,15 @@ jobs:
1316

1417
steps:
1518
- uses: actions/checkout@v4
16-
- name: Set up Python ${{ matrix.python-version }}
17-
uses: actions/setup-python@v2.2.2
19+
- name: Set up Python ${{ matrix.python-version }} + Poetry ${{ env.POETRY_VERSION }}
20+
uses: "./.github/actions/poetry_setup"
1821
with:
1922
python-version: ${{ matrix.python-version }}
20-
21-
- name: Install poetry
22-
run: curl -sSL https://install.python-poetry.org | python3 -
23+
poetry-version: ${{ env.POETRY_VERSION }}
24+
cache-key: core
2325

2426
- name: Set up cache
25-
uses: actions/cache@v2.1.6
27+
uses: actions/cache@v4
2628
with:
2729
path: .venv
2830
key: venv-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('poetry.lock') }}

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
[![Discord](https://dcbadge.vercel.app/api/server/9Rk6sSeWEG?style=flat&compact=true)](https://discord.com/invite/9Rk6sSeWEG)
1111
[![Twitter](https://img.shields.io/twitter/url/https/twitter.com/togethercompute.svg?style=social&label=Follow%20%40togethercompute)](https://twitter.com/togethercompute)
1212

13-
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.
13+
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.
1414

1515

1616

@@ -67,7 +67,7 @@ print(response.choices[0].message.content)
6767
response = client.chat.completions.create(
6868
model="meta-llama/Llama-3.2-11B-Vision-Instruct-Turbo",
6969
messages=[{
70-
"role": "user",
70+
"role": "user",
7171
"content": [
7272
{
7373
"type": "text",
@@ -91,7 +91,7 @@ response = client.chat.completions.create(
9191
"role": "user",
9292
"content": [
9393
{
94-
"type": "text",
94+
"type": "text",
9595
"text": "Compare these two images."
9696
},
9797
{

poetry.lock

Lines changed: 102 additions & 73 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ build-backend = "poetry.masonry.api"
1212

1313
[tool.poetry]
1414
name = "together"
15-
version = "1.4.2"
15+
version = "1.5.3"
1616
authors = [
1717
"Together AI <support@together.ai>"
1818
]
@@ -28,7 +28,7 @@ repository = "https://github.com/togethercomputer/together-python"
2828
homepage = "https://github.com/togethercomputer/together-python"
2929

3030
[tool.poetry.dependencies]
31-
python = "^3.9"
31+
python = "^3.10"
3232
typer = ">=0.9,<0.16"
3333
requests = "^2.31.0"
3434
rich = "^13.8.1"

src/together/cli/api/endpoints.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,11 @@ def endpoints(ctx: click.Context) -> None:
127127
is_flag=True,
128128
help="Create the endpoint in STOPPED state instead of auto-starting it",
129129
)
130+
@click.option(
131+
"--inactive-timeout",
132+
type=int,
133+
help="Number of minutes of inactivity after which the endpoint will be automatically stopped. Set to 0 to disable.",
134+
)
130135
@click.option(
131136
"--wait",
132137
is_flag=True,
@@ -146,6 +151,7 @@ def create(
146151
no_prompt_cache: bool,
147152
no_speculative_decoding: bool,
148153
no_auto_start: bool,
154+
inactive_timeout: int | None,
149155
wait: bool,
150156
) -> None:
151157
"""Create a new dedicated inference endpoint."""
@@ -170,6 +176,7 @@ def create(
170176
disable_prompt_cache=no_prompt_cache,
171177
disable_speculative_decoding=no_speculative_decoding,
172178
state="STOPPED" if no_auto_start else "STARTED",
179+
inactive_timeout=inactive_timeout,
173180
)
174181
except InvalidRequestError as e:
175182
print_api_error(e)
@@ -194,6 +201,8 @@ def create(
194201
click.echo(" Speculative decoding: disabled", err=True)
195202
if no_auto_start:
196203
click.echo(" Auto-start: disabled", err=True)
204+
if inactive_timeout is not None:
205+
click.echo(f" Inactive timeout: {inactive_timeout} minutes", err=True)
197206

198207
click.echo(f"Endpoint created successfully, id: {response.id}", err=True)
199208

@@ -371,6 +380,11 @@ def list(
371380
type=int,
372381
help="New maximum number of replicas to scale up to",
373382
)
383+
@click.option(
384+
"--inactive-timeout",
385+
type=int,
386+
help="Number of minutes of inactivity after which the endpoint will be automatically stopped. Set to 0 to disable.",
387+
)
374388
@click.pass_obj
375389
@handle_api_errors
376390
def update(
@@ -379,9 +393,10 @@ def update(
379393
display_name: str | None,
380394
min_replicas: int | None,
381395
max_replicas: int | None,
396+
inactive_timeout: int | None,
382397
) -> None:
383398
"""Update a dedicated inference endpoint's configuration."""
384-
if not any([display_name, min_replicas, max_replicas]):
399+
if not any([display_name, min_replicas, max_replicas, inactive_timeout]):
385400
click.echo("Error: At least one update option must be specified", err=True)
386401
sys.exit(1)
387402

@@ -400,6 +415,8 @@ def update(
400415
if min_replicas is not None and max_replicas is not None:
401416
kwargs["min_replicas"] = min_replicas
402417
kwargs["max_replicas"] = max_replicas
418+
if inactive_timeout is not None:
419+
kwargs["inactive_timeout"] = inactive_timeout
403420

404421
_response = client.endpoints.update(endpoint_id, **kwargs)
405422

@@ -410,6 +427,8 @@ def update(
410427
if min_replicas is not None and max_replicas is not None:
411428
click.echo(f" Min replicas: {min_replicas}", err=True)
412429
click.echo(f" Max replicas: {max_replicas}", err=True)
430+
if inactive_timeout is not None:
431+
click.echo(f" Inactive timeout: {inactive_timeout} minutes", err=True)
413432

414433
click.echo("Successfully updated endpoint", err=True)
415434
click.echo(endpoint_id)

0 commit comments

Comments
 (0)