together 1.5.35__py3-none-any.whl → 2.0.0a6__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- together/__init__.py +101 -114
- together/_base_client.py +1995 -0
- together/_client.py +1033 -0
- together/_compat.py +219 -0
- together/_constants.py +14 -0
- together/_exceptions.py +108 -0
- together/_files.py +123 -0
- together/_models.py +857 -0
- together/_qs.py +150 -0
- together/_resource.py +43 -0
- together/_response.py +830 -0
- together/_streaming.py +370 -0
- together/_types.py +260 -0
- together/_utils/__init__.py +64 -0
- together/_utils/_compat.py +45 -0
- together/_utils/_datetime_parse.py +136 -0
- together/_utils/_logs.py +25 -0
- together/_utils/_proxy.py +65 -0
- together/_utils/_reflection.py +42 -0
- together/_utils/_resources_proxy.py +24 -0
- together/_utils/_streams.py +12 -0
- together/_utils/_sync.py +58 -0
- together/_utils/_transform.py +457 -0
- together/_utils/_typing.py +156 -0
- together/_utils/_utils.py +421 -0
- together/_version.py +4 -0
- together/lib/.keep +4 -0
- together/lib/__init__.py +23 -0
- together/{cli → lib/cli}/api/endpoints.py +66 -84
- together/{cli/api/evaluation.py → lib/cli/api/evals.py} +152 -43
- together/{cli → lib/cli}/api/files.py +20 -17
- together/{cli/api/finetune.py → lib/cli/api/fine_tuning.py} +116 -172
- together/{cli → lib/cli}/api/models.py +34 -27
- together/lib/cli/api/utils.py +50 -0
- together/{cli → lib/cli}/cli.py +16 -26
- together/{constants.py → lib/constants.py} +11 -24
- together/lib/resources/__init__.py +11 -0
- together/lib/resources/files.py +999 -0
- together/lib/resources/fine_tuning.py +280 -0
- together/lib/resources/models.py +35 -0
- together/lib/types/__init__.py +13 -0
- together/lib/types/error.py +9 -0
- together/lib/types/fine_tuning.py +397 -0
- together/{utils → lib/utils}/__init__.py +6 -14
- together/{utils → lib/utils}/_log.py +11 -16
- together/{utils → lib/utils}/files.py +90 -288
- together/lib/utils/serializer.py +10 -0
- together/{utils → lib/utils}/tools.py +19 -55
- together/resources/__init__.py +225 -39
- together/resources/audio/__init__.py +72 -48
- together/resources/audio/audio.py +198 -0
- together/resources/audio/speech.py +574 -128
- together/resources/audio/transcriptions.py +247 -261
- together/resources/audio/translations.py +221 -241
- together/resources/audio/voices.py +111 -41
- together/resources/batches.py +417 -0
- together/resources/chat/__init__.py +30 -21
- together/resources/chat/chat.py +102 -0
- together/resources/chat/completions.py +1063 -263
- together/resources/code_interpreter/__init__.py +33 -0
- together/resources/code_interpreter/code_interpreter.py +258 -0
- together/resources/code_interpreter/sessions.py +135 -0
- together/resources/completions.py +884 -225
- together/resources/embeddings.py +172 -68
- together/resources/endpoints.py +589 -490
- together/resources/evals.py +452 -0
- together/resources/files.py +397 -129
- together/resources/fine_tuning.py +1033 -0
- together/resources/hardware.py +181 -0
- together/resources/images.py +258 -104
- together/resources/jobs.py +214 -0
- together/resources/models.py +223 -193
- together/resources/rerank.py +190 -92
- together/resources/videos.py +286 -214
- together/types/__init__.py +66 -167
- together/types/audio/__init__.py +10 -0
- together/types/audio/speech_create_params.py +75 -0
- together/types/audio/transcription_create_params.py +54 -0
- together/types/audio/transcription_create_response.py +111 -0
- together/types/audio/translation_create_params.py +40 -0
- together/types/audio/translation_create_response.py +70 -0
- together/types/audio/voice_list_response.py +23 -0
- together/types/audio_speech_stream_chunk.py +16 -0
- together/types/autoscaling.py +13 -0
- together/types/autoscaling_param.py +15 -0
- together/types/batch_create_params.py +24 -0
- together/types/batch_create_response.py +14 -0
- together/types/batch_job.py +45 -0
- together/types/batch_list_response.py +10 -0
- together/types/chat/__init__.py +18 -0
- together/types/chat/chat_completion.py +60 -0
- together/types/chat/chat_completion_chunk.py +61 -0
- together/types/chat/chat_completion_structured_message_image_url_param.py +18 -0
- together/types/chat/chat_completion_structured_message_text_param.py +13 -0
- together/types/chat/chat_completion_structured_message_video_url_param.py +18 -0
- together/types/chat/chat_completion_usage.py +13 -0
- together/types/chat/chat_completion_warning.py +9 -0
- together/types/chat/completion_create_params.py +329 -0
- together/types/code_interpreter/__init__.py +5 -0
- together/types/code_interpreter/session_list_response.py +31 -0
- together/types/code_interpreter_execute_params.py +45 -0
- together/types/completion.py +42 -0
- together/types/completion_chunk.py +66 -0
- together/types/completion_create_params.py +138 -0
- together/types/dedicated_endpoint.py +44 -0
- together/types/embedding.py +24 -0
- together/types/embedding_create_params.py +31 -0
- together/types/endpoint_create_params.py +43 -0
- together/types/endpoint_list_avzones_response.py +11 -0
- together/types/endpoint_list_params.py +18 -0
- together/types/endpoint_list_response.py +41 -0
- together/types/endpoint_update_params.py +27 -0
- together/types/eval_create_params.py +263 -0
- together/types/eval_create_response.py +16 -0
- together/types/eval_list_params.py +21 -0
- together/types/eval_list_response.py +10 -0
- together/types/eval_status_response.py +100 -0
- together/types/evaluation_job.py +139 -0
- together/types/execute_response.py +108 -0
- together/types/file_delete_response.py +13 -0
- together/types/file_list.py +12 -0
- together/types/file_purpose.py +9 -0
- together/types/file_response.py +31 -0
- together/types/file_type.py +7 -0
- together/types/fine_tuning_cancel_response.py +194 -0
- together/types/fine_tuning_content_params.py +24 -0
- together/types/fine_tuning_delete_params.py +11 -0
- together/types/fine_tuning_delete_response.py +12 -0
- together/types/fine_tuning_list_checkpoints_response.py +21 -0
- together/types/fine_tuning_list_events_response.py +12 -0
- together/types/fine_tuning_list_response.py +199 -0
- together/types/finetune_event.py +41 -0
- together/types/finetune_event_type.py +33 -0
- together/types/finetune_response.py +177 -0
- together/types/hardware_list_params.py +16 -0
- together/types/hardware_list_response.py +58 -0
- together/types/image_data_b64.py +15 -0
- together/types/image_data_url.py +15 -0
- together/types/image_file.py +23 -0
- together/types/image_generate_params.py +85 -0
- together/types/job_list_response.py +47 -0
- together/types/job_retrieve_response.py +43 -0
- together/types/log_probs.py +18 -0
- together/types/model_list_response.py +10 -0
- together/types/model_object.py +42 -0
- together/types/model_upload_params.py +36 -0
- together/types/model_upload_response.py +23 -0
- together/types/rerank_create_params.py +36 -0
- together/types/rerank_create_response.py +36 -0
- together/types/tool_choice.py +23 -0
- together/types/tool_choice_param.py +23 -0
- together/types/tools_param.py +23 -0
- together/types/training_method_dpo.py +22 -0
- together/types/training_method_sft.py +18 -0
- together/types/video_create_params.py +86 -0
- together/types/video_create_response.py +10 -0
- together/types/video_job.py +57 -0
- together-2.0.0a6.dist-info/METADATA +729 -0
- together-2.0.0a6.dist-info/RECORD +165 -0
- {together-1.5.35.dist-info → together-2.0.0a6.dist-info}/WHEEL +1 -1
- together-2.0.0a6.dist-info/entry_points.txt +2 -0
- {together-1.5.35.dist-info → together-2.0.0a6.dist-info}/licenses/LICENSE +1 -1
- together/abstract/api_requestor.py +0 -770
- together/cli/api/chat.py +0 -298
- together/cli/api/completions.py +0 -119
- together/cli/api/images.py +0 -93
- together/cli/api/utils.py +0 -139
- together/client.py +0 -186
- together/error.py +0 -194
- together/filemanager.py +0 -635
- together/legacy/__init__.py +0 -0
- together/legacy/base.py +0 -27
- together/legacy/complete.py +0 -93
- together/legacy/embeddings.py +0 -27
- together/legacy/files.py +0 -146
- together/legacy/finetune.py +0 -177
- together/legacy/images.py +0 -27
- together/legacy/models.py +0 -44
- together/resources/batch.py +0 -165
- together/resources/code_interpreter.py +0 -82
- together/resources/evaluation.py +0 -808
- together/resources/finetune.py +0 -1388
- together/together_response.py +0 -50
- together/types/abstract.py +0 -26
- together/types/audio_speech.py +0 -311
- together/types/batch.py +0 -54
- together/types/chat_completions.py +0 -210
- together/types/code_interpreter.py +0 -57
- together/types/common.py +0 -67
- together/types/completions.py +0 -107
- together/types/embeddings.py +0 -35
- together/types/endpoints.py +0 -123
- together/types/error.py +0 -16
- together/types/evaluation.py +0 -93
- together/types/files.py +0 -93
- together/types/finetune.py +0 -465
- together/types/images.py +0 -42
- together/types/models.py +0 -96
- together/types/rerank.py +0 -43
- together/types/videos.py +0 -69
- together/utils/api_helpers.py +0 -124
- together/version.py +0 -6
- together-1.5.35.dist-info/METADATA +0 -583
- together-1.5.35.dist-info/RECORD +0 -77
- together-1.5.35.dist-info/entry_points.txt +0 -3
- /together/{abstract → lib/cli}/__init__.py +0 -0
- /together/{cli → lib/cli/api}/__init__.py +0 -0
- /together/{cli/api/__init__.py → py.typed} +0 -0
together/types/common.py
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
from enum import Enum
|
|
4
|
-
from typing import Any, Dict, List
|
|
5
|
-
|
|
6
|
-
from pydantic import ConfigDict
|
|
7
|
-
from tqdm.utils import CallbackIOWrapper
|
|
8
|
-
|
|
9
|
-
from together.types.abstract import BaseModel
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
# Generation finish reason
|
|
13
|
-
class FinishReason(str, Enum):
|
|
14
|
-
Length = "length"
|
|
15
|
-
StopSequence = "stop"
|
|
16
|
-
EOS = "eos"
|
|
17
|
-
ToolCalls = "tool_calls"
|
|
18
|
-
Error = "error"
|
|
19
|
-
Null = ""
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
class UsageData(BaseModel):
|
|
23
|
-
prompt_tokens: int
|
|
24
|
-
completion_tokens: int
|
|
25
|
-
total_tokens: int
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
class ObjectType(str, Enum):
|
|
29
|
-
TextCompletion = "text_completion"
|
|
30
|
-
Completion = "text.completion"
|
|
31
|
-
CompletionChunk = "completion.chunk"
|
|
32
|
-
ChatCompletion = "chat.completion"
|
|
33
|
-
ChatCompletionChunk = "chat.completion.chunk"
|
|
34
|
-
Embedding = "embedding"
|
|
35
|
-
FinetuneEvent = "fine-tune-event"
|
|
36
|
-
File = "file"
|
|
37
|
-
Model = "model"
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
class LogprobsPart(BaseModel):
|
|
41
|
-
# token list
|
|
42
|
-
tokens: List[str | None] | None = None
|
|
43
|
-
# token logprob list
|
|
44
|
-
token_logprobs: List[float | None] | None = None
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
class PromptPart(BaseModel):
|
|
48
|
-
# prompt string
|
|
49
|
-
text: str | None = None
|
|
50
|
-
# list of prompt logprobs
|
|
51
|
-
logprobs: LogprobsPart | None = None
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
class DeltaContent(BaseModel):
|
|
55
|
-
content: str | None = None
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
class TogetherRequest(BaseModel):
|
|
59
|
-
model_config = ConfigDict(arbitrary_types_allowed=True)
|
|
60
|
-
|
|
61
|
-
method: str
|
|
62
|
-
url: str
|
|
63
|
-
headers: Dict[str, str] | None = None
|
|
64
|
-
params: Dict[str, Any] | CallbackIOWrapper | None = None
|
|
65
|
-
files: Dict[str, Any] | None = None
|
|
66
|
-
allow_redirects: bool = True
|
|
67
|
-
override_headers: bool = False
|
together/types/completions.py
DELETED
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
import warnings
|
|
4
|
-
from typing import Dict, List
|
|
5
|
-
|
|
6
|
-
from pydantic import model_validator
|
|
7
|
-
from typing_extensions import Self
|
|
8
|
-
|
|
9
|
-
from together.types.abstract import BaseModel
|
|
10
|
-
from together.types.common import (
|
|
11
|
-
DeltaContent,
|
|
12
|
-
FinishReason,
|
|
13
|
-
LogprobsPart,
|
|
14
|
-
ObjectType,
|
|
15
|
-
PromptPart,
|
|
16
|
-
UsageData,
|
|
17
|
-
)
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
class CompletionRequest(BaseModel):
|
|
21
|
-
# prompt to complete
|
|
22
|
-
prompt: str
|
|
23
|
-
# query model
|
|
24
|
-
model: str
|
|
25
|
-
# stopping criteria: max tokens to generate
|
|
26
|
-
max_tokens: int | None = None
|
|
27
|
-
# stopping criteria: list of strings to stop generation
|
|
28
|
-
stop: List[str] | None = None
|
|
29
|
-
# sampling hyperparameters
|
|
30
|
-
temperature: float | None = None
|
|
31
|
-
top_p: float | None = None
|
|
32
|
-
top_k: int | None = None
|
|
33
|
-
repetition_penalty: float | None = None
|
|
34
|
-
presence_penalty: float | None = None
|
|
35
|
-
frequency_penalty: float | None = None
|
|
36
|
-
min_p: float | None = None
|
|
37
|
-
logit_bias: Dict[str, float] | None = None
|
|
38
|
-
seed: int | None = None
|
|
39
|
-
# stream SSE token chunks
|
|
40
|
-
stream: bool = False
|
|
41
|
-
# return logprobs
|
|
42
|
-
logprobs: int | None = None
|
|
43
|
-
# echo prompt.
|
|
44
|
-
# can be used with logprobs to return prompt logprobs
|
|
45
|
-
echo: bool | None = None
|
|
46
|
-
# number of output generations
|
|
47
|
-
n: int | None = None
|
|
48
|
-
# moderation model
|
|
49
|
-
safety_model: str | None = None
|
|
50
|
-
|
|
51
|
-
# Raise warning if repetition_penalty is used with presence_penalty or frequency_penalty
|
|
52
|
-
@model_validator(mode="after")
|
|
53
|
-
def verify_parameters(self) -> Self:
|
|
54
|
-
if self.repetition_penalty:
|
|
55
|
-
if self.presence_penalty or self.frequency_penalty:
|
|
56
|
-
warnings.warn(
|
|
57
|
-
"repetition_penalty is not advisable to be used alongside presence_penalty or frequency_penalty"
|
|
58
|
-
)
|
|
59
|
-
return self
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
class CompletionChoicesData(BaseModel):
|
|
63
|
-
index: int
|
|
64
|
-
logprobs: LogprobsPart | None = None
|
|
65
|
-
seed: int | None = None
|
|
66
|
-
finish_reason: FinishReason
|
|
67
|
-
text: str
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
class CompletionChoicesChunk(BaseModel):
|
|
71
|
-
index: int | None = None
|
|
72
|
-
logprobs: float | None = None
|
|
73
|
-
seed: int | None = None
|
|
74
|
-
finish_reason: FinishReason | None = None
|
|
75
|
-
delta: DeltaContent | None = None
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
class CompletionResponse(BaseModel):
|
|
79
|
-
# request id
|
|
80
|
-
id: str | None = None
|
|
81
|
-
# object type
|
|
82
|
-
object: ObjectType | None = None
|
|
83
|
-
# created timestamp
|
|
84
|
-
created: int | None = None
|
|
85
|
-
# model name
|
|
86
|
-
model: str | None = None
|
|
87
|
-
# choices list
|
|
88
|
-
choices: List[CompletionChoicesData] | None = None
|
|
89
|
-
# prompt list
|
|
90
|
-
prompt: List[PromptPart] | None = None
|
|
91
|
-
# token usage data
|
|
92
|
-
usage: UsageData | None = None
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
class CompletionChunk(BaseModel):
|
|
96
|
-
# request id
|
|
97
|
-
id: str | None = None
|
|
98
|
-
# object type
|
|
99
|
-
object: ObjectType | None = None
|
|
100
|
-
# created timestamp
|
|
101
|
-
created: int | None = None
|
|
102
|
-
# model name
|
|
103
|
-
model: str | None = None
|
|
104
|
-
# choices list
|
|
105
|
-
choices: List[CompletionChoicesChunk] | None = None
|
|
106
|
-
# token usage data
|
|
107
|
-
usage: UsageData | None = None
|
together/types/embeddings.py
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
from typing import List, Literal
|
|
4
|
-
|
|
5
|
-
from together.types.abstract import BaseModel
|
|
6
|
-
from together.types.common import (
|
|
7
|
-
ObjectType,
|
|
8
|
-
)
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
class EmbeddingRequest(BaseModel):
|
|
12
|
-
# input or list of inputs
|
|
13
|
-
input: str | List[str]
|
|
14
|
-
# model to query
|
|
15
|
-
model: str
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
class EmbeddingChoicesData(BaseModel):
|
|
19
|
-
# response index
|
|
20
|
-
index: int
|
|
21
|
-
# object type
|
|
22
|
-
object: ObjectType
|
|
23
|
-
# embedding response
|
|
24
|
-
embedding: List[float] | None = None
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
class EmbeddingResponse(BaseModel):
|
|
28
|
-
# job id
|
|
29
|
-
id: str | None = None
|
|
30
|
-
# query model
|
|
31
|
-
model: str | None = None
|
|
32
|
-
# object type
|
|
33
|
-
object: Literal["list"] | None = None
|
|
34
|
-
# list of embedding choices
|
|
35
|
-
data: List[EmbeddingChoicesData] | None = None
|
together/types/endpoints.py
DELETED
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
from datetime import datetime
|
|
4
|
-
from typing import Any, Dict, Literal, Optional, Union
|
|
5
|
-
|
|
6
|
-
from pydantic import BaseModel, Field
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class TogetherJSONModel(BaseModel):
|
|
10
|
-
"""Base model with JSON serialization support."""
|
|
11
|
-
|
|
12
|
-
def model_dump(self, **kwargs: Any) -> Dict[str, Any]:
|
|
13
|
-
exclude_none = kwargs.pop("exclude_none", True)
|
|
14
|
-
data = super().model_dump(exclude_none=exclude_none, **kwargs)
|
|
15
|
-
|
|
16
|
-
# Convert datetime objects to ISO format strings
|
|
17
|
-
for key, value in data.items():
|
|
18
|
-
if isinstance(value, datetime):
|
|
19
|
-
data[key] = value.isoformat()
|
|
20
|
-
|
|
21
|
-
return data
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
class Autoscaling(TogetherJSONModel):
|
|
25
|
-
"""Configuration for automatic scaling of replicas based on demand."""
|
|
26
|
-
|
|
27
|
-
min_replicas: int = Field(
|
|
28
|
-
description="The minimum number of replicas to maintain, even when there is no load"
|
|
29
|
-
)
|
|
30
|
-
max_replicas: int = Field(
|
|
31
|
-
description="The maximum number of replicas to scale up to under load"
|
|
32
|
-
)
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
class EndpointPricing(TogetherJSONModel):
|
|
36
|
-
"""Pricing details for using an endpoint."""
|
|
37
|
-
|
|
38
|
-
cents_per_minute: float = Field(
|
|
39
|
-
description="Cost per minute of endpoint uptime in cents"
|
|
40
|
-
)
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
class HardwareSpec(TogetherJSONModel):
|
|
44
|
-
"""Detailed specifications of a hardware configuration."""
|
|
45
|
-
|
|
46
|
-
gpu_type: str = Field(description="The type/model of GPU")
|
|
47
|
-
gpu_link: str = Field(description="The GPU interconnect technology")
|
|
48
|
-
gpu_memory: Union[float, int] = Field(description="Amount of GPU memory in GB")
|
|
49
|
-
gpu_count: int = Field(description="Number of GPUs in this configuration")
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
class HardwareAvailability(TogetherJSONModel):
|
|
53
|
-
"""Indicates the current availability status of a hardware configuration."""
|
|
54
|
-
|
|
55
|
-
status: Literal["available", "unavailable", "insufficient"] = Field(
|
|
56
|
-
description="The availability status of the hardware configuration"
|
|
57
|
-
)
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
class HardwareWithStatus(TogetherJSONModel):
|
|
61
|
-
"""Hardware configuration details with optional availability status."""
|
|
62
|
-
|
|
63
|
-
object: Literal["hardware"] = Field(description="The type of object")
|
|
64
|
-
id: str = Field(description="Unique identifier for the hardware configuration")
|
|
65
|
-
pricing: EndpointPricing = Field(
|
|
66
|
-
description="Pricing details for this hardware configuration"
|
|
67
|
-
)
|
|
68
|
-
specs: HardwareSpec = Field(description="Detailed specifications of this hardware")
|
|
69
|
-
availability: Optional[HardwareAvailability] = Field(
|
|
70
|
-
default=None,
|
|
71
|
-
description="Current availability status of this hardware configuration",
|
|
72
|
-
)
|
|
73
|
-
updated_at: datetime = Field(
|
|
74
|
-
description="Timestamp of when the hardware status was last updated"
|
|
75
|
-
)
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
class BaseEndpoint(TogetherJSONModel):
|
|
79
|
-
"""Base class for endpoint models with common fields."""
|
|
80
|
-
|
|
81
|
-
object: Literal["endpoint"] = Field(description="The type of object")
|
|
82
|
-
id: Optional[str] = Field(
|
|
83
|
-
default=None, description="Unique identifier for the endpoint"
|
|
84
|
-
)
|
|
85
|
-
name: str = Field(description="System name for the endpoint")
|
|
86
|
-
model: str = Field(description="The model deployed on this endpoint")
|
|
87
|
-
type: str = Field(description="The type of endpoint")
|
|
88
|
-
owner: str = Field(description="The owner of this endpoint")
|
|
89
|
-
state: Literal[
|
|
90
|
-
"PENDING", "STARTING", "STARTED", "STOPPING", "STOPPED", "FAILED", "ERROR"
|
|
91
|
-
] = Field(description="Current state of the endpoint")
|
|
92
|
-
created_at: datetime = Field(description="Timestamp when the endpoint was created")
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
class ListEndpoint(BaseEndpoint):
|
|
96
|
-
"""Details about an endpoint when listed via the list endpoint."""
|
|
97
|
-
|
|
98
|
-
type: Literal["dedicated", "serverless"] = Field(description="The type of endpoint")
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
class DedicatedEndpoint(BaseEndpoint):
|
|
102
|
-
"""Details about a dedicated endpoint deployment."""
|
|
103
|
-
|
|
104
|
-
id: str = Field(description="Unique identifier for the endpoint")
|
|
105
|
-
type: Literal["dedicated"] = Field(description="The type of endpoint")
|
|
106
|
-
display_name: str = Field(description="Human-readable name for the endpoint")
|
|
107
|
-
hardware: str = Field(
|
|
108
|
-
description="The hardware configuration used for this endpoint"
|
|
109
|
-
)
|
|
110
|
-
autoscaling: Autoscaling = Field(
|
|
111
|
-
description="Configuration for automatic scaling of the endpoint"
|
|
112
|
-
)
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
__all__ = [
|
|
116
|
-
"DedicatedEndpoint",
|
|
117
|
-
"ListEndpoint",
|
|
118
|
-
"Autoscaling",
|
|
119
|
-
"EndpointPricing",
|
|
120
|
-
"HardwareSpec",
|
|
121
|
-
"HardwareAvailability",
|
|
122
|
-
"HardwareWithStatus",
|
|
123
|
-
]
|
together/types/error.py
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
from pydantic import Field
|
|
4
|
-
|
|
5
|
-
from together.types.abstract import BaseModel
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class TogetherErrorResponse(BaseModel):
|
|
9
|
-
# error message
|
|
10
|
-
message: str | None = None
|
|
11
|
-
# error type
|
|
12
|
-
type_: str | None = Field(None, alias="type")
|
|
13
|
-
# param causing error
|
|
14
|
-
param: str | None = None
|
|
15
|
-
# error code
|
|
16
|
-
code: str | None = None
|
together/types/evaluation.py
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
from datetime import datetime
|
|
4
|
-
from enum import Enum
|
|
5
|
-
from typing import Any, Dict, List, Literal, Optional, Union
|
|
6
|
-
|
|
7
|
-
from pydantic import BaseModel, Field
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
class EvaluationType(str, Enum):
|
|
11
|
-
CLASSIFY = "classify"
|
|
12
|
-
SCORE = "score"
|
|
13
|
-
COMPARE = "compare"
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
class EvaluationStatus(str, Enum):
|
|
17
|
-
PENDING = "pending"
|
|
18
|
-
QUEUED = "queued"
|
|
19
|
-
RUNNING = "running"
|
|
20
|
-
COMPLETED = "completed"
|
|
21
|
-
ERROR = "error"
|
|
22
|
-
USER_ERROR = "user_error"
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
class JudgeModelConfig(BaseModel):
|
|
26
|
-
model: str
|
|
27
|
-
model_source: Literal["serverless", "dedicated", "external"]
|
|
28
|
-
system_template: str
|
|
29
|
-
external_api_token: Optional[str] = None
|
|
30
|
-
external_base_url: Optional[str] = None
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
class ModelRequest(BaseModel):
|
|
34
|
-
model: str
|
|
35
|
-
model_source: Literal["serverless", "dedicated", "external"]
|
|
36
|
-
max_tokens: int
|
|
37
|
-
temperature: float
|
|
38
|
-
system_template: str
|
|
39
|
-
input_template: str
|
|
40
|
-
external_api_token: Optional[str] = None
|
|
41
|
-
external_base_url: Optional[str] = None
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
class ClassifyParameters(BaseModel):
|
|
45
|
-
judge: JudgeModelConfig
|
|
46
|
-
labels: List[str]
|
|
47
|
-
pass_labels: List[str]
|
|
48
|
-
model_to_evaluate: Optional[Union[str, ModelRequest]] = None
|
|
49
|
-
input_data_file_path: str
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
class ScoreParameters(BaseModel):
|
|
53
|
-
judge: JudgeModelConfig
|
|
54
|
-
min_score: float
|
|
55
|
-
max_score: float
|
|
56
|
-
pass_threshold: float
|
|
57
|
-
model_to_evaluate: Optional[Union[str, ModelRequest]] = None
|
|
58
|
-
input_data_file_path: str
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
class CompareParameters(BaseModel):
|
|
62
|
-
judge: JudgeModelConfig
|
|
63
|
-
model_a: Optional[Union[str, ModelRequest]] = None
|
|
64
|
-
model_b: Optional[Union[str, ModelRequest]] = None
|
|
65
|
-
input_data_file_path: str
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
class EvaluationRequest(BaseModel):
|
|
69
|
-
type: EvaluationType
|
|
70
|
-
parameters: Union[ClassifyParameters, ScoreParameters, CompareParameters]
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
class EvaluationCreateResponse(BaseModel):
|
|
74
|
-
workflow_id: str
|
|
75
|
-
status: EvaluationStatus
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
class EvaluationJob(BaseModel):
|
|
79
|
-
workflow_id: str = Field(alias="workflow_id")
|
|
80
|
-
type: Optional[EvaluationType] = None
|
|
81
|
-
status: EvaluationStatus
|
|
82
|
-
results: Optional[Dict[str, Any]] = None
|
|
83
|
-
parameters: Optional[Dict[str, Any]] = None
|
|
84
|
-
created_at: Optional[datetime] = None
|
|
85
|
-
updated_at: Optional[datetime] = None
|
|
86
|
-
|
|
87
|
-
class Config:
|
|
88
|
-
populate_by_name = True
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
class EvaluationStatusResponse(BaseModel):
|
|
92
|
-
status: EvaluationStatus
|
|
93
|
-
results: Optional[Dict[str, Any]] = None
|
together/types/files.py
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
from enum import Enum
|
|
4
|
-
from typing import List, Literal
|
|
5
|
-
|
|
6
|
-
from pydantic import Field
|
|
7
|
-
|
|
8
|
-
from together.types.abstract import BaseModel
|
|
9
|
-
from together.types.common import (
|
|
10
|
-
ObjectType,
|
|
11
|
-
)
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
class FilePurpose(str, Enum):
|
|
15
|
-
FineTune = "fine-tune"
|
|
16
|
-
BatchAPI = "batch-api"
|
|
17
|
-
Eval = "eval"
|
|
18
|
-
EvalOutput = "eval-output"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
class FileType(str, Enum):
|
|
22
|
-
jsonl = "jsonl"
|
|
23
|
-
parquet = "parquet"
|
|
24
|
-
csv = "csv"
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
class FileRequest(BaseModel):
|
|
28
|
-
"""
|
|
29
|
-
Files request type
|
|
30
|
-
"""
|
|
31
|
-
|
|
32
|
-
# training file ID
|
|
33
|
-
training_file: str
|
|
34
|
-
# base model string
|
|
35
|
-
model: str
|
|
36
|
-
# number of epochs to train for
|
|
37
|
-
n_epochs: int
|
|
38
|
-
# training learning rate
|
|
39
|
-
learning_rate: float
|
|
40
|
-
# number of checkpoints to save
|
|
41
|
-
n_checkpoints: int | None = None
|
|
42
|
-
# training batch size
|
|
43
|
-
batch_size: int | None = None
|
|
44
|
-
# up to 40 character suffix for output model name
|
|
45
|
-
suffix: str | None = None
|
|
46
|
-
# weights & biases api key
|
|
47
|
-
wandb_api_key: str | None = None
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
class FileResponse(BaseModel):
|
|
51
|
-
"""
|
|
52
|
-
Files API response type
|
|
53
|
-
"""
|
|
54
|
-
|
|
55
|
-
id: str
|
|
56
|
-
object: str
|
|
57
|
-
# created timestamp
|
|
58
|
-
created_at: int | None = None
|
|
59
|
-
type: FileType | None = None
|
|
60
|
-
purpose: FilePurpose | None = None
|
|
61
|
-
filename: str | None = None
|
|
62
|
-
# file byte size
|
|
63
|
-
bytes: int | None = None
|
|
64
|
-
# JSONL line count
|
|
65
|
-
line_count: int | None = Field(None, alias="LineCount")
|
|
66
|
-
processed: bool | None = Field(None, alias="Processed")
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
class FileList(BaseModel):
|
|
70
|
-
# object type
|
|
71
|
-
object: Literal["list"] | None = None
|
|
72
|
-
# list of fine-tune job objects
|
|
73
|
-
data: List[FileResponse] | None = None
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
class FileDeleteResponse(BaseModel):
|
|
77
|
-
# file id
|
|
78
|
-
id: str
|
|
79
|
-
# object type
|
|
80
|
-
object: Literal[ObjectType.File]
|
|
81
|
-
# is deleted
|
|
82
|
-
deleted: bool
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
class FileObject(BaseModel):
|
|
86
|
-
# object type
|
|
87
|
-
object: Literal["local"] | None = None
|
|
88
|
-
# fine-tune job id
|
|
89
|
-
id: str | None = None
|
|
90
|
-
# local path filename
|
|
91
|
-
filename: str | None = None
|
|
92
|
-
# size in bytes
|
|
93
|
-
size: int | None = None
|