Skip to content

Conversation

@blainekasten
Copy link
Contributor

@blainekasten blainekasten commented Jan 7, 2026

Summary of Supported Import Paths

This PR adds V1 compatibility shims to allow V1-style imports to continue working in V2. The following import paths are now supported:

Constants (together.constants)

from together.constants import (
    DEFAULT_TIMEOUT, MAX_RETRY_DELAY, DEFAULT_MAX_RETRIES, INITIAL_RETRY_DELAY,
    MIN_SAMPLES, DISABLE_TQDM, MAX_IMAGE_BYTES, NUM_BYTES_IN_GB,
    MAX_FILE_SIZE_GB, MIN_PART_SIZE_MB, DOWNLOAD_BLOCK_SIZE,
    MAX_MULTIPART_PARTS, TARGET_PART_SIZE_MB, MAX_CONCURRENT_PARTS,
    MAX_IMAGES_PER_EXAMPLE, MULTIPART_THRESHOLD_GB, MAX_BASE64_IMAGE_LENGTH,
    MULTIPART_UPLOAD_TIMEOUT, PARQUET_EXPECTED_COLUMNS,
    REQUIRED_COLUMNS_MESSAGE, JSONL_REQUIRED_COLUMNS_MAP,
    POSSIBLE_ROLES_CONVERSATION, DatasetFormat,
    TIMEOUT_SECS, MAX_SESSION_LIFETIME_SECS, MAX_CONNECTION_RETRIES,
    MAX_RETRIES, BASE_URL
)

Error Classes (together.error)

from together.error import (
    APIError, RateLimitError, APITimeoutError, BadRequestError,
    APIConnectionError, AuthenticationError, APIResponseValidationError,
    Timeout,  # alias for APITimeoutError
    InvalidRequestError,  # alias for BadRequestError
    TogetherException,  # alias for APIError
    ResponseError  # alias for APIResponseValidationError
)

Type Aliases (together.types)

# Direct from together.types
from together.types import (
    ChatCompletion, ChatCompletionChunk, ChatCompletionUsage,
    UsageData,  # alias for ChatCompletionUsage
    ChatCompletionResponse,  # alias for ChatCompletion
    CompletionResponse,  # alias for Completion
    ListEndpoint,  # alias for EndpointListResponse
    ImageRequest,  # alias for ImageGenerateParams
    ImageResponse  # alias for ImageFile
)

Chat Completions Types (together.types.chat_completions)

from together.types.chat_completions import (
    ToolChoice, ChatCompletion, ChatCompletionChunk,
    ChatCompletionResponse,  # alias for ChatCompletion
    ToolCalls  # alias for ToolChoice
)

Endpoints Types (together.types.endpoints)

from together.types.endpoints import (
    DedicatedEndpoint, ListEndpoint  # alias for DedicatedEndpoint
)

Files Types (together.types.files)

from together.types.files import (
    FileList, FileType, FilePurpose, FileResponse, FileDeleteResponse
)

Fine-tuning Types (together.types.finetune)

from together.types.finetune import (
    COMPLETED_STATUSES, TrainingType, FinetuneEvent, TrainingMethod,
    FinetuneRequest, EmptyLRScheduler, FinetuneProgress, FinetuneResponse,
    FullTrainingType, LoRATrainingType, CosineLRScheduler,
    FinetuneEventType, FinetuneJobStatus, LinearLRScheduler,
    TrainingMethodDPO, TrainingMethodSFT, FinetuneEventLevels,
    FinetuneLRScheduler, CosineLRSchedulerArgs, LinearLRSchedulerArgs,
    FinetuneTrainingLimits, FinetuneMultimodalParams,
    FinetuneFullTrainingLimits, FinetuneLoraTrainingLimits
)

Models Types (together.types.models)

from together.types.models import ModelObject

These compatibility shims allow existing V1 code to continue working without modification, while new V2 code can use the updated structure.


Note

Introduces V1 compatibility shims to minimize breaking changes by re-exporting V2 symbols under V1-style imports.

  • Adds together.constants shim re-exporting existing constants and defining TIMEOUT_SECS, MAX_SESSION_LIFETIME_SECS, MAX_CONNECTION_RETRIES, MAX_RETRIES, BASE_URL
  • Adds together.error shim re-exporting exceptions and legacy aliases (Timeout, InvalidRequestError, TogetherException, ResponseError)
  • Extends together.types.__init__ with aliases (ChatCompletion, ChatCompletionChunk, ChatCompletionUsage, UsageData, ChatCompletionResponse, CompletionResponse, ListEndpoint, ImageRequest, ImageResponse)
  • New type alias modules: together/types/chat_completions.py, together/types/endpoints.py, together/types/files.py, together/types/finetune.py, together/types/models.py mapping V1 names to V2 types
  • Updates uv.lock to together version 2.0.0a14

Written by Cursor Bugbot for commit 46adbeb. This will update automatically on new commits. Configure here.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

This PR is being reviewed by Cursor Bugbot

Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

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

@blainekasten blainekasten merged commit e677e60 into next Jan 9, 2026
10 checks passed
@stainless-app stainless-app bot mentioned this pull request Jan 9, 2026
stainless-app bot added a commit that referenced this pull request Jan 10, 2026
* chore: Update README for clusters CLI commands

* feat: [wip]

* feat: Add started_at timestamp to fix time estimation

* chore: Minimize breaking changes on common import paths and alias names (#206)

* Fix progress bar estimation for FT Jobs (#207)

* Fix progress bar estimation

* rebase

* fix tests

* rm

* chore(api): Remove APIs that were accidentally added in the wrong namespace

* release: 2.0.0-alpha.15

* Update CHANGELOG.md

---------

Co-authored-by: Blaine Kasten <blainekasten@gmail.com>
Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com>
Co-authored-by: Artem Chumachenko <artek.chumak@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants