Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
c756670
chore: Switch to an async version of DownloadManager (#353)
blainekasten May 7, 2026
9c1211a
docs(api): add .ogg, .opus, .aac to supported formats in audio transc…
stainless-app[bot] May 7, 2026
9889ead
docs(api): clarify prompt parameter support in audio transcriptions/t…
stainless-app[bot] May 7, 2026
f34ac96
fix(api): remove task field from audio transcription/translation resp…
stainless-app[bot] May 7, 2026
d35fb64
feat(api): add max_tokens and temperature to eval judge parameters
stainless-app[bot] May 8, 2026
d62050f
fix(client): add missing f-string prefix in file type error message
stainless-app[bot] May 8, 2026
0794576
chore: Add help examples to evals commands (#356)
blainekasten May 8, 2026
ad3cdb2
chore: Add example usage to fine-tuning CLI help pages (#357)
blainekasten May 8, 2026
1316203
chore: Add example usage for model commands (#358)
blainekasten May 8, 2026
8d2a18b
chore: Add example usage for file commands (#359)
blainekasten May 8, 2026
a357ed6
chore: Add example usage for clusters commands (#360)
blainekasten May 8, 2026
d7ea64b
codegen metadata
stainless-app[bot] May 11, 2026
e6638d2
codegen metadata
stainless-app[bot] May 11, 2026
852ef60
feat(internal/types): support eagerly validating pydantic iterators
stainless-app[bot] May 11, 2026
65c1756
docs(api): reword docstrings to present tense across resources
stainless-app[bot] May 11, 2026
cc61be0
fix(types): constrain endpoint parameter to literals in batches
stainless-app[bot] May 11, 2026
643286f
chore: Add usage examples for jig commands (#361)
blainekasten May 11, 2026
e374d1d
release: 2.13.0
stainless-app[bot] May 11, 2026
e64b446
Merge branch 'main' into release-please--branches--main--changes--next
blainekasten May 11, 2026
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.12.0"
".": "2.13.0"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 75
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/togetherai/togetherai-e1200616b1a93d40e478800d2c9e06ddeb10b508f2a9aa65810ee31878ba4f23.yml
openapi_spec_hash: 23245993d115722da1b697f10799f4f1
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/togetherai/togetherai-72e377e4d7f3fe8bb9f0dab1a70d7d9cf0f44914ff4d9b8ab238bc7f48008621.yml
openapi_spec_hash: 798c6d992a5cb83901b5879502c22f9d
config_hash: 6c214c91fad5ead4849be777fd9e8108
35 changes: 35 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,40 @@
# Changelog

## 2.13.0 (2026-05-11)

Full Changelog: [v2.12.0...v2.13.0](https://github.com/togethercomputer/together-py/compare/v2.12.0...v2.13.0)

### Features

* **api:** add max_tokens and temperature to eval judge parameters ([d35fb64](https://github.com/togethercomputer/together-py/commit/d35fb643b2cd5eff5ccb2b8b2c0eb4fbc8d30734))
* **internal/types:** support eagerly validating pydantic iterators ([852ef60](https://github.com/togethercomputer/together-py/commit/852ef60dc108bef4dc7e80ea528ca7823d7030d9))


### Bug Fixes

* **api:** remove task field from audio transcription/translation responses ([f34ac96](https://github.com/togethercomputer/together-py/commit/f34ac960a980dbb5750208ff27eae4abc283783a))
* **client:** add missing f-string prefix in file type error message ([d62050f](https://github.com/togethercomputer/together-py/commit/d62050fb50b4858ed32fa27d2024c7505d842946))
* **types:** constrain endpoint parameter to literals in batches ([cc61be0](https://github.com/togethercomputer/together-py/commit/cc61be030cc95d6a3d8e262ec47f7ceacfd2eb75))


### Chores

* Add example usage for clusters commands ([#360](https://github.com/togethercomputer/together-py/issues/360)) ([a357ed6](https://github.com/togethercomputer/together-py/commit/a357ed65e81e3b1a94c3e5e63c7d2d8840f3f421))
* Add example usage for file commands ([#359](https://github.com/togethercomputer/together-py/issues/359)) ([8d2a18b](https://github.com/togethercomputer/together-py/commit/8d2a18b2647585f4e83bd42c679e699c841cd545))
* Add example usage for model commands ([#358](https://github.com/togethercomputer/together-py/issues/358)) ([1316203](https://github.com/togethercomputer/together-py/commit/13162032b1ae100ecc7c1a08f454b30474f0a6b4))
* Add example usage to fine-tuning CLI help pages ([#357](https://github.com/togethercomputer/together-py/issues/357)) ([ad3cdb2](https://github.com/togethercomputer/together-py/commit/ad3cdb2d0d4f5511fa06105c4a7169cc72cf9306))
* Add examples to the CLI help output for endpoint commands ([#354](https://github.com/togethercomputer/together-py/issues/354)) ([f51b5e8](https://github.com/togethercomputer/together-py/commit/f51b5e8ec65be8cee2eef9270b1af55cbdc2cd91))
* Add help examples to evals commands ([#356](https://github.com/togethercomputer/together-py/issues/356)) ([0794576](https://github.com/togethercomputer/together-py/commit/0794576cd274a8a55240b3a1b780df8b23261a7c))
* Add usage examples for jig commands ([#361](https://github.com/togethercomputer/together-py/issues/361)) ([643286f](https://github.com/togethercomputer/together-py/commit/643286f390291ebb3e5fed85c4fb1dc5dd9cd981))
* Switch to an async version of DownloadManager ([#353](https://github.com/togethercomputer/together-py/issues/353)) ([c756670](https://github.com/togethercomputer/together-py/commit/c7566702fb57fcce808bb23ba1bc9b0737b9c352))


### Documentation

* **api:** add .ogg, .opus, .aac to supported formats in audio transcriptions/translations ([9c1211a](https://github.com/togethercomputer/together-py/commit/9c1211a8143dc435ef351dd57b9553d39ae06b8e))
* **api:** clarify prompt parameter support in audio transcriptions/translations ([9889ead](https://github.com/togethercomputer/together-py/commit/9889ead58a66864a37d01ef0bbe92b4bc8786ff5))
* **api:** reword docstrings to present tense across resources ([65c1756](https://github.com/togethercomputer/together-py/commit/65c175682f4f8432dfe4d880d6dc0a21acc46655))

## 2.12.0 (2026-05-01)

Full Changelog: [v2.11.0...v2.12.0](https://github.com/togethercomputer/together-py/compare/v2.11.0...v2.12.0)
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.12.0"
version = "2.13.0"
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/_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ async def async_to_httpx_files(files: RequestFiles | None) -> HttpxRequestFiles
elif is_sequence_t(files):
files = [(key, await _async_transform_file(file)) for key, file in files]
else:
raise TypeError("Unexpected file type input {type(files)}, expected mapping or sequence")
raise TypeError(f"Unexpected file type input {type(files)}, expected mapping or sequence")

return files

Expand Down
80 changes: 80 additions & 0 deletions src/together/_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
ClassVar,
Protocol,
Required,
Annotated,
ParamSpec,
TypeAlias,
TypedDict,
TypeGuard,
final,
Expand Down Expand Up @@ -79,7 +81,15 @@
from ._constants import RAW_RESPONSE_HEADER

if TYPE_CHECKING:
from pydantic import GetCoreSchemaHandler, ValidatorFunctionWrapHandler
from pydantic_core import CoreSchema, core_schema
from pydantic_core.core_schema import ModelField, ModelSchema, LiteralSchema, ModelFieldsSchema
else:
try:
from pydantic_core import CoreSchema, core_schema
except ImportError:
CoreSchema = None
core_schema = None

__all__ = ["BaseModel", "GenericModel"]

Expand Down Expand Up @@ -396,6 +406,76 @@ def model_dump_json(
)


class _EagerIterable(list[_T], Generic[_T]):
"""
Accepts any Iterable[T] input (including generators), consumes it
eagerly, and validates all items upfront.

Validation preserves the original container type where possible
(e.g. a set[T] stays a set[T]). Serialization (model_dump / JSON)
always emits a list — round-tripping through model_dump() will not
restore the original container type.
"""

@classmethod
def __get_pydantic_core_schema__(
cls,
source_type: Any,
handler: GetCoreSchemaHandler,
) -> CoreSchema:
(item_type,) = get_args(source_type) or (Any,)
item_schema: CoreSchema = handler.generate_schema(item_type)
list_of_items_schema: CoreSchema = core_schema.list_schema(item_schema)

return core_schema.no_info_wrap_validator_function(
cls._validate,
list_of_items_schema,
serialization=core_schema.plain_serializer_function_ser_schema(
cls._serialize,
info_arg=False,
),
)

@staticmethod
def _validate(v: Iterable[_T], handler: "ValidatorFunctionWrapHandler") -> Any:
original_type: type[Any] = type(v)

# Normalize to list so list_schema can validate each item
if isinstance(v, list):
items: list[_T] = v
else:
try:
items = list(v)
except TypeError as e:
raise TypeError("Value is not iterable") from e

# Validate items against the inner schema
validated: list[_T] = handler(items)

# Reconstruct original container type
if original_type is list:
return validated
# str(list) produces the list's repr, not a string built from items,
# so skip reconstruction for str and its subclasses.
if issubclass(original_type, str):
return validated
try:
return original_type(validated)
except (TypeError, ValueError):
# If the type cannot be reconstructed, just return the validated list
return validated

@staticmethod
def _serialize(v: Iterable[_T]) -> list[_T]:
"""Always serialize as a list so Pydantic's JSON encoder is happy."""
if isinstance(v, list):
return v
return list(v)


EagerIterable: TypeAlias = Annotated[Iterable[_T], _EagerIterable]


def _construct_field(value: object, field: FieldInfo, key: str) -> object:
if value is None:
return field_get_default(field)
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.12.0" # x-release-please-version
__version__ = "2.13.0" # x-release-please-version
2 changes: 2 additions & 0 deletions src/together/lib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@
UploadManager,
DownloadManager,
AsyncUploadManager,
AsyncDownloadManager,
)

__all__ = [
"DownloadManager",
"AsyncDownloadManager",
"AsyncUploadManager",
"UploadManager",
"FinetuneTrainingLimits",
Expand Down
Loading
Loading