Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "2.0.0-alpha.5"
".": "2.0.0-alpha.6"
}
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 43
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/togetherai%2Ftogetherai-e9e60279414ac3279c025d6318b5f67a8f6d01170e365612e791f3a1f259b94f.yml
openapi_spec_hash: 26c59292808c5ae9f222f95f056430cf
config_hash: 23c87c234dd773a896773436c7eb2a28
config_hash: 468163c38238466d0306b30eb29cb0d0
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## 2.0.0-alpha.6 (2025-11-25)

Full Changelog: [v2.0.0-alpha.5...v2.0.0-alpha.6](https://github.com/togethercomputer/together-py/compare/v2.0.0-alpha.5...v2.0.0-alpha.6)

### Chores

* **api:** Cleanup some exported types ([bf57f0d](https://github.com/togethercomputer/together-py/commit/bf57f0d49619651e96565d99a9291aa55873e4f0))
* fix lint and type checks ([#186](https://github.com/togethercomputer/together-py/issues/186)) ([7184b72](https://github.com/togethercomputer/together-py/commit/7184b72f79aa2b255a0921f5fc4680e75f0d8847))

## 2.0.0-alpha.5 (2025-11-25)

Full Changelog: [v2.0.0-alpha.4...v2.0.0-alpha.5](https://github.com/togethercomputer/together-py/compare/v2.0.0-alpha.4...v2.0.0-alpha.5)
Expand Down
35 changes: 12 additions & 23 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,19 @@ Types:

```python
from together.types import (
FileList,
FileObject,
FilePurpose,
FileResponse,
FileType,
FileRetrieveResponse,
FileListResponse,
FileDeleteResponse,
)
```

Methods:

- <code title="get /files/{id}">client.files.<a href="./src/together/resources/files.py">retrieve</a>(id) -> <a href="./src/together/types/file_retrieve_response.py">FileRetrieveResponse</a></code>
- <code title="get /files">client.files.<a href="./src/together/resources/files.py">list</a>() -> <a href="./src/together/types/file_list_response.py">FileListResponse</a></code>
- <code title="get /files/{id}">client.files.<a href="./src/together/resources/files.py">retrieve</a>(id) -> <a href="./src/together/types/file_response.py">FileResponse</a></code>
- <code title="get /files">client.files.<a href="./src/together/resources/files.py">list</a>() -> <a href="./src/together/types/file_list.py">FileList</a></code>
- <code title="delete /files/{id}">client.files.<a href="./src/together/resources/files.py">delete</a>(id) -> <a href="./src/together/types/file_delete_response.py">FileDeleteResponse</a></code>
- <code title="get /files/{id}/content">client.files.<a href="./src/together/resources/files.py">content</a>(id) -> BinaryAPIResponse</code>

Expand All @@ -72,15 +72,9 @@ Types:

```python
from together.types import (
CosineLrSchedulerArgs,
FineTune,
FineTuneEvent,
FullTrainingType,
LinearLrSchedulerArgs,
LoRaTrainingType,
LrScheduler,
TrainingMethodDpo,
TrainingMethodSft,
FinetuneEvent,
FinetuneEventType,
FinetuneResponse,
FineTuningListResponse,
FineTuningDeleteResponse,
FineTuningCancelResponse,
Expand All @@ -91,7 +85,7 @@ from together.types import (

Methods:

- <code title="get /fine-tunes/{id}">client.fine_tuning.<a href="./src/together/resources/fine_tuning.py">retrieve</a>(id) -> <a href="./src/together/types/fine_tune.py">FineTune</a></code>
- <code title="get /fine-tunes/{id}">client.fine_tuning.<a href="./src/together/resources/fine_tuning.py">retrieve</a>(id) -> <a href="./src/together/types/finetune_response.py">FinetuneResponse</a></code>
- <code title="get /fine-tunes">client.fine_tuning.<a href="./src/together/resources/fine_tuning.py">list</a>() -> <a href="./src/together/types/fine_tuning_list_response.py">FineTuningListResponse</a></code>
- <code title="delete /fine-tunes/{id}">client.fine_tuning.<a href="./src/together/resources/fine_tuning.py">delete</a>(id, \*\*<a href="src/together/types/fine_tuning_delete_params.py">params</a>) -> <a href="./src/together/types/fine_tuning_delete_response.py">FineTuningDeleteResponse</a></code>
- <code title="post /fine-tunes/{id}/cancel">client.fine_tuning.<a href="./src/together/resources/fine_tuning.py">cancel</a>(id) -> <a href="./src/together/types/fine_tuning_cancel_response.py">FineTuningCancelResponse</a></code>
Expand Down Expand Up @@ -203,7 +197,7 @@ Methods:
Types:

```python
from together.types import ModelListResponse, ModelUploadResponse
from together.types import ModelObject, ModelListResponse, ModelUploadResponse
```

Methods:
Expand Down Expand Up @@ -275,20 +269,15 @@ Methods:
Types:

```python
from together.types import (
BatchCreateResponse,
BatchRetrieveResponse,
BatchListResponse,
BatchCancelResponse,
)
from together.types import BatchJob, BatchCreateResponse, BatchListResponse
```

Methods:

- <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>
- <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>
- <code title="get /batches/{id}">client.batches.<a href="./src/together/resources/batches.py">retrieve</a>(id) -> <a href="./src/together/types/batch_job.py">BatchJob</a></code>
- <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>
- <code title="post /batches/{id}/cancel">client.batches.<a href="./src/together/resources/batches.py">cancel</a>(id) -> <a href="./src/together/types/batch_cancel_response.py">BatchCancelResponse</a></code>
- <code title="post /batches/{id}/cancel">client.batches.<a href="./src/together/resources/batches.py">cancel</a>(id) -> <a href="./src/together/types/batch_job.py">BatchJob</a></code>

# Evals

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "together"
version = "2.0.0-alpha.5"
version = "2.0.0-alpha.6"
description = "The official Python library for the together API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion src/together/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

__title__ = "together"
__version__ = "2.0.0-alpha.5" # x-release-please-version
__version__ = "2.0.0-alpha.6" # x-release-please-version
6 changes: 3 additions & 3 deletions src/together/lib/cli/api/fine_tuning.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
from click.core import ParameterSource # type: ignore[attr-defined]

from together import Together
from together.types import FullTrainingType, LoRaTrainingType
from together._types import NOT_GIVEN, NotGiven
from together.lib.utils import log_warn
from together.lib.utils.tools import format_timestamp, finetune_price_to_dollars
from together.lib.cli.api.utils import INT_WITH_MAX, BOOL_WITH_AUTO
from together.lib.resources.files import DownloadManager
from together.lib.utils.serializer import datetime_serializer
from together.types.finetune_response import TrainingTypeFullTrainingType, TrainingTypeLoRaTrainingType
from together.lib.resources.fine_tuning import get_model_limits

_CONFIRMATION_MESSAGE = (
Expand Down Expand Up @@ -513,11 +513,11 @@ def download(
ft_job = client.fine_tuning.retrieve(fine_tune_id)

loosely_typed_checkpoint_type: str | NotGiven = checkpoint_type
if isinstance(ft_job.training_type, FullTrainingType):
if isinstance(ft_job.training_type, TrainingTypeFullTrainingType):
if checkpoint_type != "default":
raise ValueError("Only DEFAULT checkpoint type is allowed for FullTrainingType")
loosely_typed_checkpoint_type = "model_output_path"
elif isinstance(ft_job.training_type, LoRaTrainingType):
elif isinstance(ft_job.training_type, TrainingTypeLoRaTrainingType):
if checkpoint_type == "default":
loosely_typed_checkpoint_type = "merged"

Expand Down
34 changes: 17 additions & 17 deletions src/together/lib/resources/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from filelock import FileLock
from tqdm.utils import CallbackIOWrapper

from ...types import FileType, FilePurpose, FileRetrieveResponse
from ...types import FileType, FilePurpose, FileResponse
from ..._types import RequestOptions
from ..constants import (
DISABLE_TQDM,
Expand Down Expand Up @@ -273,9 +273,9 @@ def get_upload_url(

return redirect_url, file_id

def callback(self, url: str) -> FileRetrieveResponse:
def callback(self, url: str) -> FileResponse:
response = self._client.post(
cast_to=FileRetrieveResponse,
cast_to=FileResponse,
path=url,
)

Expand All @@ -286,7 +286,7 @@ def upload(
url: str,
file: Path,
purpose: FilePurpose,
) -> FileRetrieveResponse:
) -> FileResponse:
file_size = os.stat(file.as_posix()).st_size
file_size_gb = file_size / NUM_BYTES_IN_GB

Expand All @@ -306,7 +306,7 @@ def _upload_single_file(
url: str,
file: Path,
purpose: FilePurpose,
) -> FileRetrieveResponse:
) -> FileResponse:
file_id = None

redirect_url = None
Expand Down Expand Up @@ -357,7 +357,7 @@ def _upload_single_file(

response = self.callback(f"{url}/{file_id}/preprocess")

assert isinstance(response, FileRetrieveResponse) # type: ignore
assert isinstance(response, FileResponse) # type: ignore

return response

Expand All @@ -374,7 +374,7 @@ def upload(
url: str,
file: Path,
purpose: FilePurpose,
) -> FileRetrieveResponse:
) -> FileResponse:
"""Upload large file using multipart upload"""

file_size = os.stat(file.as_posix()).st_size
Expand Down Expand Up @@ -551,7 +551,7 @@ def _complete_upload(
upload_id: str,
file_id: str,
completed_parts: List[Dict[str, Any]],
) -> FileRetrieveResponse:
) -> FileResponse:
"""Complete the multipart upload"""

payload = {
Expand All @@ -576,7 +576,7 @@ def _complete_upload(
if response.status_code == 200:
response_data = response.json()
file_data = response_data.get("file", response_data)
return FileRetrieveResponse(**file_data)
return FileResponse(**file_data)
else:
raise APIStatusError(
f"Failed to complete multipart upload: {response.text}",
Expand Down Expand Up @@ -654,9 +654,9 @@ async def get_upload_url(

return redirect_url, file_id

async def callback(self, url: str) -> FileRetrieveResponse:
async def callback(self, url: str) -> FileResponse:
response = self._client.post(
cast_to=FileRetrieveResponse,
cast_to=FileResponse,
path=url,
)

Expand All @@ -667,7 +667,7 @@ async def upload(
url: str,
file: Path,
purpose: FilePurpose,
) -> FileRetrieveResponse:
) -> FileResponse:
file_size = os.stat(file.as_posix()).st_size
file_size_gb = file_size / NUM_BYTES_IN_GB

Expand All @@ -687,7 +687,7 @@ async def _upload_single_file(
url: str,
file: Path,
purpose: FilePurpose,
) -> FileRetrieveResponse:
) -> FileResponse:
file_id = None

redirect_url = None
Expand Down Expand Up @@ -738,7 +738,7 @@ async def _upload_single_file(

response = await self.callback(f"{url}/{file_id}/preprocess")

assert isinstance(response, FileRetrieveResponse) # type: ignore
assert isinstance(response, FileResponse) # type: ignore

return response

Expand All @@ -755,7 +755,7 @@ async def upload(
url: str,
file: Path,
purpose: FilePurpose,
) -> FileRetrieveResponse:
) -> FileResponse:
"""Upload large file using multipart upload via ThreadPoolExecutor"""

file_size = os.stat(file.as_posix()).st_size
Expand Down Expand Up @@ -932,7 +932,7 @@ async def _complete_upload(
upload_id: str,
file_id: str,
completed_parts: List[Dict[str, Any]],
) -> FileRetrieveResponse:
) -> FileResponse:
"""Complete the multipart upload"""

payload = {
Expand All @@ -957,7 +957,7 @@ async def _complete_upload(
if response.status_code == 200:
response_data = response.json()
file_data = response_data.get("file", response_data)
return FileRetrieveResponse(**file_data)
return FileResponse(**file_data)
else:
raise APIStatusError(
f"Failed to complete multipart upload: {response.text}",
Expand Down
19 changes: 9 additions & 10 deletions src/together/resources/batches.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@
async_to_streamed_response_wrapper,
)
from .._base_client import make_request_options
from ..types.batch_job import BatchJob
from ..types.batch_list_response import BatchListResponse
from ..types.batch_cancel_response import BatchCancelResponse
from ..types.batch_create_response import BatchCreateResponse
from ..types.batch_retrieve_response import BatchRetrieveResponse

__all__ = ["BatchesResource", "AsyncBatchesResource"]

Expand Down Expand Up @@ -109,7 +108,7 @@ def retrieve(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> BatchRetrieveResponse:
) -> BatchJob:
"""
Get details of a batch job by ID

Expand All @@ -129,7 +128,7 @@ def retrieve(
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=BatchRetrieveResponse,
cast_to=BatchJob,
)

def list(
Expand Down Expand Up @@ -161,7 +160,7 @@ def cancel(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> BatchCancelResponse:
) -> BatchJob:
"""
Cancel a batch job by ID

Expand All @@ -181,7 +180,7 @@ def cancel(
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=BatchCancelResponse,
cast_to=BatchJob,
)


Expand Down Expand Up @@ -270,7 +269,7 @@ async def retrieve(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> BatchRetrieveResponse:
) -> BatchJob:
"""
Get details of a batch job by ID

Expand All @@ -290,7 +289,7 @@ async def retrieve(
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=BatchRetrieveResponse,
cast_to=BatchJob,
)

async def list(
Expand Down Expand Up @@ -322,7 +321,7 @@ async def cancel(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> BatchCancelResponse:
) -> BatchJob:
"""
Cancel a batch job by ID

Expand All @@ -342,7 +341,7 @@ async def cancel(
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=BatchCancelResponse,
cast_to=BatchJob,
)


Expand Down
Loading
Loading