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
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing_extensions import Required, TypedDict
|
|
6
|
+
|
|
7
|
+
__all__ = ["BatchCreateParams"]
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class BatchCreateParams(TypedDict, total=False):
|
|
11
|
+
endpoint: Required[str]
|
|
12
|
+
"""The endpoint to use for batch processing"""
|
|
13
|
+
|
|
14
|
+
input_file_id: Required[str]
|
|
15
|
+
"""ID of the uploaded input file containing batch requests"""
|
|
16
|
+
|
|
17
|
+
completion_window: str
|
|
18
|
+
"""Time window for batch completion (optional)"""
|
|
19
|
+
|
|
20
|
+
model_id: str
|
|
21
|
+
"""Model to use for processing batch requests"""
|
|
22
|
+
|
|
23
|
+
priority: int
|
|
24
|
+
"""Priority for batch processing (optional)"""
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing import Optional
|
|
4
|
+
|
|
5
|
+
from .._models import BaseModel
|
|
6
|
+
from .batch_job import BatchJob
|
|
7
|
+
|
|
8
|
+
__all__ = ["BatchCreateResponse"]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class BatchCreateResponse(BaseModel):
|
|
12
|
+
job: Optional[BatchJob] = None
|
|
13
|
+
|
|
14
|
+
warning: Optional[str] = None
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing import Optional
|
|
4
|
+
from datetime import datetime
|
|
5
|
+
from typing_extensions import Literal
|
|
6
|
+
|
|
7
|
+
from pydantic import Field as FieldInfo
|
|
8
|
+
|
|
9
|
+
from .._models import BaseModel
|
|
10
|
+
|
|
11
|
+
__all__ = ["BatchJob"]
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class BatchJob(BaseModel):
|
|
15
|
+
id: Optional[str] = None
|
|
16
|
+
|
|
17
|
+
completed_at: Optional[datetime] = None
|
|
18
|
+
|
|
19
|
+
created_at: Optional[datetime] = None
|
|
20
|
+
|
|
21
|
+
endpoint: Optional[str] = None
|
|
22
|
+
|
|
23
|
+
error: Optional[str] = None
|
|
24
|
+
|
|
25
|
+
error_file_id: Optional[str] = None
|
|
26
|
+
|
|
27
|
+
file_size_bytes: Optional[int] = None
|
|
28
|
+
"""Size of input file in bytes"""
|
|
29
|
+
|
|
30
|
+
input_file_id: Optional[str] = None
|
|
31
|
+
|
|
32
|
+
job_deadline: Optional[datetime] = None
|
|
33
|
+
|
|
34
|
+
x_model_id: Optional[str] = FieldInfo(alias="model_id", default=None)
|
|
35
|
+
"""Model used for processing requests"""
|
|
36
|
+
|
|
37
|
+
output_file_id: Optional[str] = None
|
|
38
|
+
|
|
39
|
+
progress: Optional[float] = None
|
|
40
|
+
"""Completion progress (0.0 to 100)"""
|
|
41
|
+
|
|
42
|
+
status: Optional[Literal["VALIDATING", "IN_PROGRESS", "COMPLETED", "FAILED", "EXPIRED", "CANCELLED"]] = None
|
|
43
|
+
"""Current status of the batch job"""
|
|
44
|
+
|
|
45
|
+
user_id: Optional[str] = None
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing import List
|
|
4
|
+
from typing_extensions import TypeAlias
|
|
5
|
+
|
|
6
|
+
from .batch_job import BatchJob
|
|
7
|
+
|
|
8
|
+
__all__ = ["BatchListResponse"]
|
|
9
|
+
|
|
10
|
+
BatchListResponse: TypeAlias = List[BatchJob]
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from .chat_completion import ChatCompletion as ChatCompletion
|
|
6
|
+
from .chat_completion_chunk import ChatCompletionChunk as ChatCompletionChunk
|
|
7
|
+
from .chat_completion_usage import ChatCompletionUsage as ChatCompletionUsage
|
|
8
|
+
from .chat_completion_warning import ChatCompletionWarning as ChatCompletionWarning
|
|
9
|
+
from .completion_create_params import CompletionCreateParams as CompletionCreateParams
|
|
10
|
+
from .chat_completion_structured_message_text_param import (
|
|
11
|
+
ChatCompletionStructuredMessageTextParam as ChatCompletionStructuredMessageTextParam,
|
|
12
|
+
)
|
|
13
|
+
from .chat_completion_structured_message_image_url_param import (
|
|
14
|
+
ChatCompletionStructuredMessageImageURLParam as ChatCompletionStructuredMessageImageURLParam,
|
|
15
|
+
)
|
|
16
|
+
from .chat_completion_structured_message_video_url_param import (
|
|
17
|
+
ChatCompletionStructuredMessageVideoURLParam as ChatCompletionStructuredMessageVideoURLParam,
|
|
18
|
+
)
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing import List, Optional
|
|
4
|
+
from typing_extensions import Literal
|
|
5
|
+
|
|
6
|
+
from ..._models import BaseModel
|
|
7
|
+
from ..log_probs import LogProbs
|
|
8
|
+
from ..tool_choice import ToolChoice
|
|
9
|
+
from .chat_completion_usage import ChatCompletionUsage
|
|
10
|
+
from .chat_completion_warning import ChatCompletionWarning
|
|
11
|
+
|
|
12
|
+
__all__ = ["ChatCompletion", "Choice", "ChoiceMessage", "ChoiceMessageFunctionCall"]
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class ChoiceMessageFunctionCall(BaseModel):
|
|
16
|
+
arguments: str
|
|
17
|
+
|
|
18
|
+
name: str
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class ChoiceMessage(BaseModel):
|
|
22
|
+
content: Optional[str] = None
|
|
23
|
+
|
|
24
|
+
role: Literal["assistant"]
|
|
25
|
+
|
|
26
|
+
function_call: Optional[ChoiceMessageFunctionCall] = None
|
|
27
|
+
|
|
28
|
+
reasoning: Optional[str] = None
|
|
29
|
+
|
|
30
|
+
tool_calls: Optional[List[ToolChoice]] = None
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class Choice(BaseModel):
|
|
34
|
+
finish_reason: Optional[Literal["stop", "eos", "length", "tool_calls", "function_call"]] = None
|
|
35
|
+
|
|
36
|
+
index: Optional[int] = None
|
|
37
|
+
|
|
38
|
+
logprobs: Optional[LogProbs] = None
|
|
39
|
+
|
|
40
|
+
message: Optional[ChoiceMessage] = None
|
|
41
|
+
|
|
42
|
+
seed: Optional[int] = None
|
|
43
|
+
|
|
44
|
+
text: Optional[str] = None
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
class ChatCompletion(BaseModel):
|
|
48
|
+
id: str
|
|
49
|
+
|
|
50
|
+
choices: List[Choice]
|
|
51
|
+
|
|
52
|
+
created: int
|
|
53
|
+
|
|
54
|
+
model: str
|
|
55
|
+
|
|
56
|
+
object: Literal["chat.completion"]
|
|
57
|
+
|
|
58
|
+
usage: Optional[ChatCompletionUsage] = None
|
|
59
|
+
|
|
60
|
+
warnings: Optional[List[ChatCompletionWarning]] = None
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing import List, Optional
|
|
4
|
+
from typing_extensions import Literal
|
|
5
|
+
|
|
6
|
+
from ..._models import BaseModel
|
|
7
|
+
from ..tool_choice import ToolChoice
|
|
8
|
+
from .chat_completion_usage import ChatCompletionUsage
|
|
9
|
+
from .chat_completion_warning import ChatCompletionWarning
|
|
10
|
+
|
|
11
|
+
__all__ = ["ChatCompletionChunk", "Choice", "ChoiceDelta", "ChoiceDeltaFunctionCall"]
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class ChoiceDeltaFunctionCall(BaseModel):
|
|
15
|
+
arguments: str
|
|
16
|
+
|
|
17
|
+
name: str
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class ChoiceDelta(BaseModel):
|
|
21
|
+
role: Literal["system", "user", "assistant", "function", "tool"]
|
|
22
|
+
|
|
23
|
+
content: Optional[str] = None
|
|
24
|
+
|
|
25
|
+
function_call: Optional[ChoiceDeltaFunctionCall] = None
|
|
26
|
+
|
|
27
|
+
reasoning: Optional[str] = None
|
|
28
|
+
|
|
29
|
+
token_id: Optional[int] = None
|
|
30
|
+
|
|
31
|
+
tool_calls: Optional[List[ToolChoice]] = None
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class Choice(BaseModel):
|
|
35
|
+
delta: ChoiceDelta
|
|
36
|
+
|
|
37
|
+
finish_reason: Optional[Literal["stop", "eos", "length", "tool_calls", "function_call"]] = None
|
|
38
|
+
|
|
39
|
+
index: int
|
|
40
|
+
|
|
41
|
+
logprobs: Optional[float] = None
|
|
42
|
+
|
|
43
|
+
seed: Optional[int] = None
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
class ChatCompletionChunk(BaseModel):
|
|
47
|
+
id: str
|
|
48
|
+
|
|
49
|
+
choices: List[Choice]
|
|
50
|
+
|
|
51
|
+
created: int
|
|
52
|
+
|
|
53
|
+
model: str
|
|
54
|
+
|
|
55
|
+
object: Literal["chat.completion.chunk"]
|
|
56
|
+
|
|
57
|
+
system_fingerprint: Optional[str] = None
|
|
58
|
+
|
|
59
|
+
usage: Optional[ChatCompletionUsage] = None
|
|
60
|
+
|
|
61
|
+
warnings: Optional[List[ChatCompletionWarning]] = None
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing_extensions import Literal, Required, TypedDict
|
|
6
|
+
|
|
7
|
+
__all__ = ["ChatCompletionStructuredMessageImageURLParam", "ImageURL"]
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class ImageURL(TypedDict, total=False):
|
|
11
|
+
url: Required[str]
|
|
12
|
+
"""The URL of the image"""
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class ChatCompletionStructuredMessageImageURLParam(TypedDict, total=False):
|
|
16
|
+
image_url: ImageURL
|
|
17
|
+
|
|
18
|
+
type: Literal["image_url"]
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing_extensions import Literal, Required, TypedDict
|
|
6
|
+
|
|
7
|
+
__all__ = ["ChatCompletionStructuredMessageTextParam"]
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class ChatCompletionStructuredMessageTextParam(TypedDict, total=False):
|
|
11
|
+
text: Required[str]
|
|
12
|
+
|
|
13
|
+
type: Required[Literal["text"]]
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing_extensions import Literal, Required, TypedDict
|
|
6
|
+
|
|
7
|
+
__all__ = ["ChatCompletionStructuredMessageVideoURLParam", "VideoURL"]
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class VideoURL(TypedDict, total=False):
|
|
11
|
+
url: Required[str]
|
|
12
|
+
"""The URL of the video"""
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class ChatCompletionStructuredMessageVideoURLParam(TypedDict, total=False):
|
|
16
|
+
type: Required[Literal["video_url"]]
|
|
17
|
+
|
|
18
|
+
video_url: Required[VideoURL]
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from ..._models import BaseModel
|
|
4
|
+
|
|
5
|
+
__all__ = ["ChatCompletionUsage"]
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class ChatCompletionUsage(BaseModel):
|
|
9
|
+
completion_tokens: int
|
|
10
|
+
|
|
11
|
+
prompt_tokens: int
|
|
12
|
+
|
|
13
|
+
total_tokens: int
|
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Dict, Union, Iterable, Optional
|
|
6
|
+
from typing_extensions import Literal, Required, TypeAlias, TypedDict
|
|
7
|
+
|
|
8
|
+
from ..._types import SequenceNotStr
|
|
9
|
+
from ..tools_param import ToolsParam
|
|
10
|
+
from ..tool_choice_param import ToolChoiceParam
|
|
11
|
+
from .chat_completion_structured_message_text_param import ChatCompletionStructuredMessageTextParam
|
|
12
|
+
from .chat_completion_structured_message_image_url_param import ChatCompletionStructuredMessageImageURLParam
|
|
13
|
+
from .chat_completion_structured_message_video_url_param import ChatCompletionStructuredMessageVideoURLParam
|
|
14
|
+
|
|
15
|
+
__all__ = [
|
|
16
|
+
"CompletionCreateParamsBase",
|
|
17
|
+
"Message",
|
|
18
|
+
"MessageChatCompletionSystemMessageParam",
|
|
19
|
+
"MessageChatCompletionUserMessageParam",
|
|
20
|
+
"MessageChatCompletionUserMessageParamContentChatCompletionUserMessageContentMultimodal",
|
|
21
|
+
"MessageChatCompletionUserMessageParamContentChatCompletionUserMessageContentMultimodalAudio",
|
|
22
|
+
"MessageChatCompletionUserMessageParamContentChatCompletionUserMessageContentMultimodalAudioAudioURL",
|
|
23
|
+
"MessageChatCompletionUserMessageParamContentChatCompletionUserMessageContentMultimodalInputAudio",
|
|
24
|
+
"MessageChatCompletionUserMessageParamContentChatCompletionUserMessageContentMultimodalInputAudioInputAudio",
|
|
25
|
+
"MessageChatCompletionAssistantMessageParam",
|
|
26
|
+
"MessageChatCompletionAssistantMessageParamFunctionCall",
|
|
27
|
+
"MessageChatCompletionToolMessageParam",
|
|
28
|
+
"MessageChatCompletionFunctionMessageParam",
|
|
29
|
+
"FunctionCall",
|
|
30
|
+
"FunctionCallName",
|
|
31
|
+
"ResponseFormat",
|
|
32
|
+
"ToolChoice",
|
|
33
|
+
"CompletionCreateParamsNonStreaming",
|
|
34
|
+
"CompletionCreateParamsStreaming",
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class CompletionCreateParamsBase(TypedDict, total=False):
|
|
39
|
+
messages: Required[Iterable[Message]]
|
|
40
|
+
"""A list of messages comprising the conversation so far."""
|
|
41
|
+
|
|
42
|
+
model: Required[
|
|
43
|
+
Union[
|
|
44
|
+
Literal[
|
|
45
|
+
"Qwen/Qwen2.5-72B-Instruct-Turbo",
|
|
46
|
+
"Qwen/Qwen2.5-7B-Instruct-Turbo",
|
|
47
|
+
"meta-llama/Meta-Llama-3.1-405B-Instruct-Turbo",
|
|
48
|
+
"meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo",
|
|
49
|
+
"meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo",
|
|
50
|
+
],
|
|
51
|
+
str,
|
|
52
|
+
]
|
|
53
|
+
]
|
|
54
|
+
"""The name of the model to query.
|
|
55
|
+
|
|
56
|
+
[See all of Together AI's chat models](https://docs.together.ai/docs/serverless-models#chat-models)
|
|
57
|
+
"""
|
|
58
|
+
|
|
59
|
+
context_length_exceeded_behavior: Literal["truncate", "error"]
|
|
60
|
+
"""
|
|
61
|
+
Defined the behavior of the API when max_tokens exceed the maximum context
|
|
62
|
+
length of the model. When set to 'error', API will return 400 with appropriate
|
|
63
|
+
error message. When set to 'truncate', override the max_tokens with maximum
|
|
64
|
+
context length of the model.
|
|
65
|
+
"""
|
|
66
|
+
|
|
67
|
+
echo: bool
|
|
68
|
+
"""If true, the response will contain the prompt.
|
|
69
|
+
|
|
70
|
+
Can be used with `logprobs` to return prompt logprobs.
|
|
71
|
+
"""
|
|
72
|
+
|
|
73
|
+
frequency_penalty: float
|
|
74
|
+
"""
|
|
75
|
+
A number between -2.0 and 2.0 where a positive value decreases the likelihood of
|
|
76
|
+
repeating tokens that have already been mentioned.
|
|
77
|
+
"""
|
|
78
|
+
|
|
79
|
+
function_call: FunctionCall
|
|
80
|
+
|
|
81
|
+
logit_bias: Dict[str, float]
|
|
82
|
+
"""Adjusts the likelihood of specific tokens appearing in the generated output."""
|
|
83
|
+
|
|
84
|
+
logprobs: int
|
|
85
|
+
"""
|
|
86
|
+
An integer between 0 and 20 of the top k tokens to return log probabilities for
|
|
87
|
+
at each generation step, instead of just the sampled token. Log probabilities
|
|
88
|
+
help assess model confidence in token predictions.
|
|
89
|
+
"""
|
|
90
|
+
|
|
91
|
+
max_tokens: int
|
|
92
|
+
"""The maximum number of tokens to generate."""
|
|
93
|
+
|
|
94
|
+
min_p: float
|
|
95
|
+
"""A number between 0 and 1 that can be used as an alternative to top_p and top-k."""
|
|
96
|
+
|
|
97
|
+
n: int
|
|
98
|
+
"""The number of completions to generate for each prompt."""
|
|
99
|
+
|
|
100
|
+
presence_penalty: float
|
|
101
|
+
"""
|
|
102
|
+
A number between -2.0 and 2.0 where a positive value increases the likelihood of
|
|
103
|
+
a model talking about new topics.
|
|
104
|
+
"""
|
|
105
|
+
|
|
106
|
+
reasoning_effort: Literal["low", "medium", "high"]
|
|
107
|
+
"""
|
|
108
|
+
Controls the level of reasoning effort the model should apply when generating
|
|
109
|
+
responses. Higher values may result in more thoughtful and detailed responses
|
|
110
|
+
but may take longer to generate.
|
|
111
|
+
"""
|
|
112
|
+
|
|
113
|
+
repetition_penalty: float
|
|
114
|
+
"""
|
|
115
|
+
A number that controls the diversity of generated text by reducing the
|
|
116
|
+
likelihood of repeated sequences. Higher values decrease repetition.
|
|
117
|
+
"""
|
|
118
|
+
|
|
119
|
+
response_format: ResponseFormat
|
|
120
|
+
"""An object specifying the format that the model must output."""
|
|
121
|
+
|
|
122
|
+
safety_model: str
|
|
123
|
+
"""The name of the moderation model used to validate tokens.
|
|
124
|
+
|
|
125
|
+
Choose from the available moderation models found
|
|
126
|
+
[here](https://docs.together.ai/docs/inference-models#moderation-models).
|
|
127
|
+
"""
|
|
128
|
+
|
|
129
|
+
seed: int
|
|
130
|
+
"""Seed value for reproducibility."""
|
|
131
|
+
|
|
132
|
+
stop: SequenceNotStr[str]
|
|
133
|
+
"""A list of string sequences that will truncate (stop) inference text output.
|
|
134
|
+
|
|
135
|
+
For example, "</s>" will stop generation as soon as the model generates the
|
|
136
|
+
given token.
|
|
137
|
+
"""
|
|
138
|
+
|
|
139
|
+
temperature: float
|
|
140
|
+
"""
|
|
141
|
+
A decimal number from 0-1 that determines the degree of randomness in the
|
|
142
|
+
response. A temperature less than 1 favors more correctness and is appropriate
|
|
143
|
+
for question answering or summarization. A value closer to 1 introduces more
|
|
144
|
+
randomness in the output.
|
|
145
|
+
"""
|
|
146
|
+
|
|
147
|
+
tool_choice: ToolChoice
|
|
148
|
+
"""Controls which (if any) function is called by the model.
|
|
149
|
+
|
|
150
|
+
By default uses `auto`, which lets the model pick between generating a message
|
|
151
|
+
or calling a function.
|
|
152
|
+
"""
|
|
153
|
+
|
|
154
|
+
tools: Iterable[ToolsParam]
|
|
155
|
+
"""A list of tools the model may call.
|
|
156
|
+
|
|
157
|
+
Currently, only functions are supported as a tool. Use this to provide a list of
|
|
158
|
+
functions the model may generate JSON inputs for.
|
|
159
|
+
"""
|
|
160
|
+
|
|
161
|
+
top_k: int
|
|
162
|
+
"""
|
|
163
|
+
An integer that's used to limit the number of choices for the next predicted
|
|
164
|
+
word or token. It specifies the maximum number of tokens to consider at each
|
|
165
|
+
step, based on their probability of occurrence. This technique helps to speed up
|
|
166
|
+
the generation process and can improve the quality of the generated text by
|
|
167
|
+
focusing on the most likely options.
|
|
168
|
+
"""
|
|
169
|
+
|
|
170
|
+
top_p: float
|
|
171
|
+
"""
|
|
172
|
+
A percentage (also called the nucleus parameter) that's used to dynamically
|
|
173
|
+
adjust the number of choices for each predicted token based on the cumulative
|
|
174
|
+
probabilities. It specifies a probability threshold below which all less likely
|
|
175
|
+
tokens are filtered out. This technique helps maintain diversity and generate
|
|
176
|
+
more fluent and natural-sounding text.
|
|
177
|
+
"""
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
class MessageChatCompletionSystemMessageParam(TypedDict, total=False):
|
|
181
|
+
content: Required[str]
|
|
182
|
+
|
|
183
|
+
role: Required[Literal["system"]]
|
|
184
|
+
|
|
185
|
+
name: str
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
class MessageChatCompletionUserMessageParamContentChatCompletionUserMessageContentMultimodalAudioAudioURL(
|
|
189
|
+
TypedDict, total=False
|
|
190
|
+
):
|
|
191
|
+
url: Required[str]
|
|
192
|
+
"""The URL of the audio"""
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
class MessageChatCompletionUserMessageParamContentChatCompletionUserMessageContentMultimodalAudio(
|
|
196
|
+
TypedDict, total=False
|
|
197
|
+
):
|
|
198
|
+
audio_url: Required[
|
|
199
|
+
MessageChatCompletionUserMessageParamContentChatCompletionUserMessageContentMultimodalAudioAudioURL
|
|
200
|
+
]
|
|
201
|
+
|
|
202
|
+
type: Required[Literal["audio_url"]]
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
class MessageChatCompletionUserMessageParamContentChatCompletionUserMessageContentMultimodalInputAudioInputAudio(
|
|
206
|
+
TypedDict, total=False
|
|
207
|
+
):
|
|
208
|
+
data: Required[str]
|
|
209
|
+
"""The base64 encoded audio data"""
|
|
210
|
+
|
|
211
|
+
format: Required[Literal["wav"]]
|
|
212
|
+
"""The format of the audio data"""
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
class MessageChatCompletionUserMessageParamContentChatCompletionUserMessageContentMultimodalInputAudio(
|
|
216
|
+
TypedDict, total=False
|
|
217
|
+
):
|
|
218
|
+
input_audio: Required[
|
|
219
|
+
MessageChatCompletionUserMessageParamContentChatCompletionUserMessageContentMultimodalInputAudioInputAudio
|
|
220
|
+
]
|
|
221
|
+
|
|
222
|
+
type: Required[Literal["input_audio"]]
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
MessageChatCompletionUserMessageParamContentChatCompletionUserMessageContentMultimodal: TypeAlias = Union[
|
|
226
|
+
ChatCompletionStructuredMessageTextParam,
|
|
227
|
+
ChatCompletionStructuredMessageImageURLParam,
|
|
228
|
+
ChatCompletionStructuredMessageVideoURLParam,
|
|
229
|
+
MessageChatCompletionUserMessageParamContentChatCompletionUserMessageContentMultimodalAudio,
|
|
230
|
+
MessageChatCompletionUserMessageParamContentChatCompletionUserMessageContentMultimodalInputAudio,
|
|
231
|
+
]
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
class MessageChatCompletionUserMessageParam(TypedDict, total=False):
|
|
235
|
+
content: Required[
|
|
236
|
+
Union[str, Iterable[MessageChatCompletionUserMessageParamContentChatCompletionUserMessageContentMultimodal]]
|
|
237
|
+
]
|
|
238
|
+
"""
|
|
239
|
+
The content of the message, which can either be a simple string or a structured
|
|
240
|
+
format.
|
|
241
|
+
"""
|
|
242
|
+
|
|
243
|
+
role: Required[Literal["user"]]
|
|
244
|
+
|
|
245
|
+
name: str
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
class MessageChatCompletionAssistantMessageParamFunctionCall(TypedDict, total=False):
|
|
249
|
+
arguments: Required[str]
|
|
250
|
+
|
|
251
|
+
name: Required[str]
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
class MessageChatCompletionAssistantMessageParam(TypedDict, total=False):
|
|
255
|
+
role: Required[Literal["assistant"]]
|
|
256
|
+
|
|
257
|
+
content: Optional[str]
|
|
258
|
+
|
|
259
|
+
function_call: MessageChatCompletionAssistantMessageParamFunctionCall
|
|
260
|
+
|
|
261
|
+
name: str
|
|
262
|
+
|
|
263
|
+
tool_calls: Iterable[ToolChoiceParam]
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
class MessageChatCompletionToolMessageParam(TypedDict, total=False):
|
|
267
|
+
content: Required[str]
|
|
268
|
+
|
|
269
|
+
role: Required[Literal["tool"]]
|
|
270
|
+
|
|
271
|
+
tool_call_id: Required[str]
|
|
272
|
+
|
|
273
|
+
name: str
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
class MessageChatCompletionFunctionMessageParam(TypedDict, total=False):
|
|
277
|
+
content: Required[str]
|
|
278
|
+
|
|
279
|
+
name: Required[str]
|
|
280
|
+
|
|
281
|
+
role: Required[Literal["function"]]
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
Message: TypeAlias = Union[
|
|
285
|
+
MessageChatCompletionSystemMessageParam,
|
|
286
|
+
MessageChatCompletionUserMessageParam,
|
|
287
|
+
MessageChatCompletionAssistantMessageParam,
|
|
288
|
+
MessageChatCompletionToolMessageParam,
|
|
289
|
+
MessageChatCompletionFunctionMessageParam,
|
|
290
|
+
]
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
class FunctionCallName(TypedDict, total=False):
|
|
294
|
+
name: Required[str]
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
FunctionCall: TypeAlias = Union[Literal["none", "auto"], FunctionCallName]
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
class ResponseFormat(TypedDict, total=False):
|
|
301
|
+
schema: Dict[str, object]
|
|
302
|
+
"""The schema of the response format."""
|
|
303
|
+
|
|
304
|
+
type: str
|
|
305
|
+
"""The type of the response format."""
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
ToolChoice: TypeAlias = Union[str, ToolChoiceParam]
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
class CompletionCreateParamsNonStreaming(CompletionCreateParamsBase, total=False):
|
|
312
|
+
stream: Literal[False]
|
|
313
|
+
"""
|
|
314
|
+
If true, stream tokens as Server-Sent Events as the model generates them instead
|
|
315
|
+
of waiting for the full model response. The stream terminates with
|
|
316
|
+
`data: [DONE]`. If false, return a single JSON object containing the results.
|
|
317
|
+
"""
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
class CompletionCreateParamsStreaming(CompletionCreateParamsBase):
|
|
321
|
+
stream: Required[Literal[True]]
|
|
322
|
+
"""
|
|
323
|
+
If true, stream tokens as Server-Sent Events as the model generates them instead
|
|
324
|
+
of waiting for the full model response. The stream terminates with
|
|
325
|
+
`data: [DONE]`. If false, return a single JSON object containing the results.
|
|
326
|
+
"""
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
CompletionCreateParams = Union[CompletionCreateParamsNonStreaming, CompletionCreateParamsStreaming]
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing import Dict, List, Union, Optional
|
|
4
|
+
from datetime import datetime
|
|
5
|
+
|
|
6
|
+
from ..._models import BaseModel
|
|
7
|
+
|
|
8
|
+
__all__ = ["SessionListResponse", "Data", "DataSession"]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class DataSession(BaseModel):
|
|
12
|
+
id: str
|
|
13
|
+
"""Session Identifier. Used to make follow-up calls."""
|
|
14
|
+
|
|
15
|
+
execute_count: int
|
|
16
|
+
|
|
17
|
+
expires_at: datetime
|
|
18
|
+
|
|
19
|
+
last_execute_at: datetime
|
|
20
|
+
|
|
21
|
+
started_at: datetime
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class Data(BaseModel):
|
|
25
|
+
sessions: List[DataSession]
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class SessionListResponse(BaseModel):
|
|
29
|
+
data: Optional[Data] = None
|
|
30
|
+
|
|
31
|
+
errors: Optional[List[Union[str, Dict[str, object]]]] = None
|