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
34 changes: 34 additions & 0 deletions src/together/constants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Manually added to minimize breaking changes from V1
from ._constants import (
MAX_RETRY_DELAY as MAX_RETRY_DELAY,
DEFAULT_MAX_RETRIES,
INITIAL_RETRY_DELAY as INITIAL_RETRY_DELAY,
)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing DEFAULT_TIMEOUT export from compatibility module

Medium Severity

The PR description explicitly states that DEFAULT_TIMEOUT should be importable from together.constants, but the new compatibility shim file doesn't include it in the imports from ._constants. The constant exists in src/together/_constants.py (as an httpx.Timeout object), but users attempting from together.constants import DEFAULT_TIMEOUT will get an ImportError. This breaks the V1 compatibility that this PR aims to provide.

Fix in Cursor Fix in Web

from .lib.constants import (
MIN_SAMPLES as MIN_SAMPLES,
DISABLE_TQDM as DISABLE_TQDM,
MAX_IMAGE_BYTES as MAX_IMAGE_BYTES,
NUM_BYTES_IN_GB as NUM_BYTES_IN_GB,
MAX_FILE_SIZE_GB as MAX_FILE_SIZE_GB,
MIN_PART_SIZE_MB as MIN_PART_SIZE_MB,
DOWNLOAD_BLOCK_SIZE as DOWNLOAD_BLOCK_SIZE,
MAX_MULTIPART_PARTS as MAX_MULTIPART_PARTS,
TARGET_PART_SIZE_MB as TARGET_PART_SIZE_MB,
MAX_CONCURRENT_PARTS as MAX_CONCURRENT_PARTS,
MAX_IMAGES_PER_EXAMPLE as MAX_IMAGES_PER_EXAMPLE,
MULTIPART_THRESHOLD_GB as MULTIPART_THRESHOLD_GB,
MAX_BASE64_IMAGE_LENGTH as MAX_BASE64_IMAGE_LENGTH,
MULTIPART_UPLOAD_TIMEOUT as MULTIPART_UPLOAD_TIMEOUT,
PARQUET_EXPECTED_COLUMNS as PARQUET_EXPECTED_COLUMNS,
REQUIRED_COLUMNS_MESSAGE as REQUIRED_COLUMNS_MESSAGE,
JSONL_REQUIRED_COLUMNS_MAP as JSONL_REQUIRED_COLUMNS_MAP,
POSSIBLE_ROLES_CONVERSATION as POSSIBLE_ROLES_CONVERSATION,
DatasetFormat as DatasetFormat,
)

TIMEOUT_SECS = 600
MAX_SESSION_LIFETIME_SECS = 180
MAX_CONNECTION_RETRIES = 2
MAX_RETRIES = DEFAULT_MAX_RETRIES

BASE_URL = "https://api.together.xyz/v1"
16 changes: 16 additions & 0 deletions src/together/error.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

# Manually added to minimize breaking changes from V1
from ._exceptions import (
APIError as APIError,
RateLimitError as RateLimitError,
APITimeoutError,
BadRequestError,
APIConnectionError as APIConnectionError,
AuthenticationError as AuthenticationError,
APIResponseValidationError,
)

Timeout = APITimeoutError
InvalidRequestError = BadRequestError
TogetherException = APIError
ResponseError = APIResponseValidationError
13 changes: 12 additions & 1 deletion src/together/types/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from __future__ import annotations
from __future__ import annotations # noqa

from .batch_job import BatchJob as BatchJob
from .embedding import Embedding as Embedding
Expand Down Expand Up @@ -68,3 +68,14 @@
from .fine_tuning_list_checkpoints_response import (
FineTuningListCheckpointsResponse as FineTuningListCheckpointsResponse,
)

# Manually added to minimize breaking changes from V1
from .chat.chat_completion import ChatCompletion
from .chat.chat_completion_chunk import ChatCompletionChunk as ChatCompletionChunk
from .chat.chat_completion_usage import ChatCompletionUsage
UsageData = ChatCompletionUsage
ChatCompletionResponse = ChatCompletion
CompletionResponse = Completion
ListEndpoint = EndpointListResponse
ImageRequest = ImageGenerateParams
ImageResponse = ImageFile
7 changes: 7 additions & 0 deletions src/together/types/chat_completions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Manually added to minimize breaking changes from V1
from .tool_choice import ToolChoice
from .chat.chat_completion import ChatCompletion
from .chat.chat_completion_chunk import ChatCompletionChunk as ChatCompletionChunk

ChatCompletionResponse = ChatCompletion
ToolCalls = ToolChoice
4 changes: 4 additions & 0 deletions src/together/types/endpoints.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Manually added to minimize breaking changes from V1
from together.types import DedicatedEndpoint as DedicatedEndpoint

ListEndpoint = DedicatedEndpoint
8 changes: 8 additions & 0 deletions src/together/types/files.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Manually added to minimize breaking changes from V1
from . import (
FileList as FileList,
FileType as FileType,
FilePurpose as FilePurpose,
FileResponse as FileResponse,
FileDeleteResponse as FileDeleteResponse,
)
27 changes: 27 additions & 0 deletions src/together/types/finetune.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Manually added to minimize breaking changes from V1
from ..lib.types.fine_tuning import (
COMPLETED_STATUSES as COMPLETED_STATUSES,
TrainingType as TrainingType,
FinetuneEvent as FinetuneEvent,
TrainingMethod as TrainingMethod,
FinetuneRequest as FinetuneRequest,
EmptyLRScheduler as EmptyLRScheduler,
FinetuneProgress as FinetuneProgress,
FinetuneResponse as FinetuneResponse,
FullTrainingType as FullTrainingType,
LoRATrainingType as LoRATrainingType,
CosineLRScheduler as CosineLRScheduler,
FinetuneEventType as FinetuneEventType,
FinetuneJobStatus as FinetuneJobStatus,
LinearLRScheduler as LinearLRScheduler,
TrainingMethodDPO as TrainingMethodDPO,
TrainingMethodSFT as TrainingMethodSFT,
FinetuneEventLevels as FinetuneEventLevels,
FinetuneLRScheduler as FinetuneLRScheduler,
CosineLRSchedulerArgs as CosineLRSchedulerArgs,
LinearLRSchedulerArgs as LinearLRSchedulerArgs,
FinetuneTrainingLimits as FinetuneTrainingLimits,
FinetuneMultimodalParams as FinetuneMultimodalParams,
FinetuneFullTrainingLimits as FinetuneFullTrainingLimits,
FinetuneLoraTrainingLimits as FinetuneLoraTrainingLimits,
)
2 changes: 2 additions & 0 deletions src/together/types/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Manually added to minimize breaking changes from V1
from together.types import ModelObject as ModelObject
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.