together 1.5.17__py3-none-any.whl → 2.0.0a8__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.
Files changed (205) hide show
  1. together/__init__.py +101 -63
  2. together/_base_client.py +1995 -0
  3. together/_client.py +1033 -0
  4. together/_compat.py +219 -0
  5. together/_constants.py +14 -0
  6. together/_exceptions.py +108 -0
  7. together/_files.py +123 -0
  8. together/_models.py +857 -0
  9. together/_qs.py +150 -0
  10. together/_resource.py +43 -0
  11. together/_response.py +830 -0
  12. together/_streaming.py +370 -0
  13. together/_types.py +260 -0
  14. together/_utils/__init__.py +64 -0
  15. together/_utils/_compat.py +45 -0
  16. together/_utils/_datetime_parse.py +136 -0
  17. together/_utils/_logs.py +25 -0
  18. together/_utils/_proxy.py +65 -0
  19. together/_utils/_reflection.py +42 -0
  20. together/_utils/_resources_proxy.py +24 -0
  21. together/_utils/_streams.py +12 -0
  22. together/_utils/_sync.py +58 -0
  23. together/_utils/_transform.py +457 -0
  24. together/_utils/_typing.py +156 -0
  25. together/_utils/_utils.py +421 -0
  26. together/_version.py +4 -0
  27. together/lib/.keep +4 -0
  28. together/lib/__init__.py +23 -0
  29. together/{cli → lib/cli}/api/endpoints.py +108 -75
  30. together/lib/cli/api/evals.py +588 -0
  31. together/{cli → lib/cli}/api/files.py +20 -17
  32. together/{cli/api/finetune.py → lib/cli/api/fine_tuning.py} +161 -120
  33. together/lib/cli/api/models.py +140 -0
  34. together/{cli → lib/cli}/api/utils.py +6 -7
  35. together/{cli → lib/cli}/cli.py +16 -24
  36. together/{constants.py → lib/constants.py} +17 -12
  37. together/lib/resources/__init__.py +11 -0
  38. together/lib/resources/files.py +999 -0
  39. together/lib/resources/fine_tuning.py +280 -0
  40. together/lib/resources/models.py +35 -0
  41. together/lib/types/__init__.py +13 -0
  42. together/lib/types/error.py +9 -0
  43. together/lib/types/fine_tuning.py +455 -0
  44. together/{utils → lib/utils}/__init__.py +6 -14
  45. together/{utils → lib/utils}/_log.py +11 -16
  46. together/lib/utils/files.py +628 -0
  47. together/lib/utils/serializer.py +10 -0
  48. together/{utils → lib/utils}/tools.py +19 -55
  49. together/resources/__init__.py +225 -33
  50. together/resources/audio/__init__.py +72 -21
  51. together/resources/audio/audio.py +198 -0
  52. together/resources/audio/speech.py +574 -122
  53. together/resources/audio/transcriptions.py +282 -0
  54. together/resources/audio/translations.py +256 -0
  55. together/resources/audio/voices.py +135 -0
  56. together/resources/batches.py +417 -0
  57. together/resources/chat/__init__.py +30 -21
  58. together/resources/chat/chat.py +102 -0
  59. together/resources/chat/completions.py +1063 -263
  60. together/resources/code_interpreter/__init__.py +33 -0
  61. together/resources/code_interpreter/code_interpreter.py +258 -0
  62. together/resources/code_interpreter/sessions.py +135 -0
  63. together/resources/completions.py +884 -225
  64. together/resources/embeddings.py +172 -68
  65. together/resources/endpoints.py +598 -395
  66. together/resources/evals.py +452 -0
  67. together/resources/files.py +398 -121
  68. together/resources/fine_tuning.py +1033 -0
  69. together/resources/hardware.py +181 -0
  70. together/resources/images.py +256 -108
  71. together/resources/jobs.py +214 -0
  72. together/resources/models.py +238 -90
  73. together/resources/rerank.py +190 -92
  74. together/resources/videos.py +374 -0
  75. together/types/__init__.py +65 -109
  76. together/types/audio/__init__.py +10 -0
  77. together/types/audio/speech_create_params.py +75 -0
  78. together/types/audio/transcription_create_params.py +54 -0
  79. together/types/audio/transcription_create_response.py +111 -0
  80. together/types/audio/translation_create_params.py +40 -0
  81. together/types/audio/translation_create_response.py +70 -0
  82. together/types/audio/voice_list_response.py +23 -0
  83. together/types/audio_speech_stream_chunk.py +16 -0
  84. together/types/autoscaling.py +13 -0
  85. together/types/autoscaling_param.py +15 -0
  86. together/types/batch_create_params.py +24 -0
  87. together/types/batch_create_response.py +14 -0
  88. together/types/batch_job.py +45 -0
  89. together/types/batch_list_response.py +10 -0
  90. together/types/chat/__init__.py +18 -0
  91. together/types/chat/chat_completion.py +60 -0
  92. together/types/chat/chat_completion_chunk.py +61 -0
  93. together/types/chat/chat_completion_structured_message_image_url_param.py +18 -0
  94. together/types/chat/chat_completion_structured_message_text_param.py +13 -0
  95. together/types/chat/chat_completion_structured_message_video_url_param.py +18 -0
  96. together/types/chat/chat_completion_usage.py +13 -0
  97. together/types/chat/chat_completion_warning.py +9 -0
  98. together/types/chat/completion_create_params.py +329 -0
  99. together/types/code_interpreter/__init__.py +5 -0
  100. together/types/code_interpreter/session_list_response.py +31 -0
  101. together/types/code_interpreter_execute_params.py +45 -0
  102. together/types/completion.py +42 -0
  103. together/types/completion_chunk.py +66 -0
  104. together/types/completion_create_params.py +138 -0
  105. together/types/dedicated_endpoint.py +44 -0
  106. together/types/embedding.py +24 -0
  107. together/types/embedding_create_params.py +31 -0
  108. together/types/endpoint_create_params.py +43 -0
  109. together/types/endpoint_list_avzones_response.py +11 -0
  110. together/types/endpoint_list_params.py +18 -0
  111. together/types/endpoint_list_response.py +41 -0
  112. together/types/endpoint_update_params.py +27 -0
  113. together/types/eval_create_params.py +263 -0
  114. together/types/eval_create_response.py +16 -0
  115. together/types/eval_list_params.py +21 -0
  116. together/types/eval_list_response.py +10 -0
  117. together/types/eval_status_response.py +100 -0
  118. together/types/evaluation_job.py +139 -0
  119. together/types/execute_response.py +108 -0
  120. together/types/file_delete_response.py +13 -0
  121. together/types/file_list.py +12 -0
  122. together/types/file_purpose.py +9 -0
  123. together/types/file_response.py +31 -0
  124. together/types/file_type.py +7 -0
  125. together/types/fine_tuning_cancel_response.py +194 -0
  126. together/types/fine_tuning_content_params.py +24 -0
  127. together/types/fine_tuning_delete_params.py +11 -0
  128. together/types/fine_tuning_delete_response.py +12 -0
  129. together/types/fine_tuning_list_checkpoints_response.py +21 -0
  130. together/types/fine_tuning_list_events_response.py +12 -0
  131. together/types/fine_tuning_list_response.py +199 -0
  132. together/types/finetune_event.py +41 -0
  133. together/types/finetune_event_type.py +33 -0
  134. together/types/finetune_response.py +177 -0
  135. together/types/hardware_list_params.py +16 -0
  136. together/types/hardware_list_response.py +58 -0
  137. together/types/image_data_b64.py +15 -0
  138. together/types/image_data_url.py +15 -0
  139. together/types/image_file.py +23 -0
  140. together/types/image_generate_params.py +85 -0
  141. together/types/job_list_response.py +47 -0
  142. together/types/job_retrieve_response.py +43 -0
  143. together/types/log_probs.py +18 -0
  144. together/types/model_list_response.py +10 -0
  145. together/types/model_object.py +42 -0
  146. together/types/model_upload_params.py +36 -0
  147. together/types/model_upload_response.py +23 -0
  148. together/types/rerank_create_params.py +36 -0
  149. together/types/rerank_create_response.py +36 -0
  150. together/types/tool_choice.py +23 -0
  151. together/types/tool_choice_param.py +23 -0
  152. together/types/tools_param.py +23 -0
  153. together/types/training_method_dpo.py +22 -0
  154. together/types/training_method_sft.py +18 -0
  155. together/types/video_create_params.py +86 -0
  156. together/types/video_job.py +57 -0
  157. together-2.0.0a8.dist-info/METADATA +680 -0
  158. together-2.0.0a8.dist-info/RECORD +164 -0
  159. {together-1.5.17.dist-info → together-2.0.0a8.dist-info}/WHEEL +1 -1
  160. together-2.0.0a8.dist-info/entry_points.txt +2 -0
  161. {together-1.5.17.dist-info → together-2.0.0a8.dist-info/licenses}/LICENSE +1 -1
  162. together/abstract/api_requestor.py +0 -729
  163. together/cli/api/chat.py +0 -276
  164. together/cli/api/completions.py +0 -119
  165. together/cli/api/images.py +0 -93
  166. together/cli/api/models.py +0 -55
  167. together/client.py +0 -176
  168. together/error.py +0 -194
  169. together/filemanager.py +0 -389
  170. together/legacy/__init__.py +0 -0
  171. together/legacy/base.py +0 -27
  172. together/legacy/complete.py +0 -93
  173. together/legacy/embeddings.py +0 -27
  174. together/legacy/files.py +0 -146
  175. together/legacy/finetune.py +0 -177
  176. together/legacy/images.py +0 -27
  177. together/legacy/models.py +0 -44
  178. together/resources/batch.py +0 -136
  179. together/resources/code_interpreter.py +0 -82
  180. together/resources/finetune.py +0 -1064
  181. together/together_response.py +0 -50
  182. together/types/abstract.py +0 -26
  183. together/types/audio_speech.py +0 -110
  184. together/types/batch.py +0 -53
  185. together/types/chat_completions.py +0 -197
  186. together/types/code_interpreter.py +0 -57
  187. together/types/common.py +0 -66
  188. together/types/completions.py +0 -107
  189. together/types/embeddings.py +0 -35
  190. together/types/endpoints.py +0 -123
  191. together/types/error.py +0 -16
  192. together/types/files.py +0 -90
  193. together/types/finetune.py +0 -398
  194. together/types/images.py +0 -44
  195. together/types/models.py +0 -45
  196. together/types/rerank.py +0 -43
  197. together/utils/api_helpers.py +0 -124
  198. together/utils/files.py +0 -425
  199. together/version.py +0 -6
  200. together-1.5.17.dist-info/METADATA +0 -525
  201. together-1.5.17.dist-info/RECORD +0 -69
  202. together-1.5.17.dist-info/entry_points.txt +0 -3
  203. /together/{abstract → lib/cli}/__init__.py +0 -0
  204. /together/{cli → lib/cli/api}/__init__.py +0 -0
  205. /together/{cli/api/__init__.py → py.typed} +0 -0
@@ -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,5 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from .session_list_response import SessionListResponse as SessionListResponse
@@ -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
@@ -0,0 +1,45 @@
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 Iterable
6
+ from typing_extensions import Literal, Required, TypedDict
7
+
8
+ __all__ = ["CodeInterpreterExecuteParams", "File"]
9
+
10
+
11
+ class CodeInterpreterExecuteParams(TypedDict, total=False):
12
+ code: Required[str]
13
+ """Code snippet to execute."""
14
+
15
+ language: Required[Literal["python"]]
16
+ """Programming language for the code to execute.
17
+
18
+ Currently only supports Python, but more will be added.
19
+ """
20
+
21
+ files: Iterable[File]
22
+ """Files to upload to the session.
23
+
24
+ If present, files will be uploaded before executing the given code.
25
+ """
26
+
27
+ session_id: str
28
+ """Identifier of the current session.
29
+
30
+ Used to make follow-up calls. Requests will return an error if the session does
31
+ not belong to the caller or has expired.
32
+ """
33
+
34
+
35
+ class File(TypedDict, total=False):
36
+ content: Required[str]
37
+
38
+ encoding: Required[Literal["string", "base64"]]
39
+ """Encoding of the file content.
40
+
41
+ Use `string` for text files such as code, and `base64` for binary files, such as
42
+ images.
43
+ """
44
+
45
+ name: Required[str]
@@ -0,0 +1,42 @@
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 .chat.chat_completion_usage import ChatCompletionUsage
9
+
10
+ __all__ = ["Completion", "Choice", "Prompt"]
11
+
12
+
13
+ class Choice(BaseModel):
14
+ finish_reason: Optional[Literal["stop", "eos", "length", "tool_calls", "function_call"]] = None
15
+
16
+ logprobs: Optional[LogProbs] = None
17
+
18
+ seed: Optional[int] = None
19
+
20
+ text: Optional[str] = None
21
+
22
+
23
+ class Prompt(BaseModel):
24
+ logprobs: Optional[LogProbs] = None
25
+
26
+ text: Optional[str] = None
27
+
28
+
29
+ class Completion(BaseModel):
30
+ id: str
31
+
32
+ choices: List[Choice]
33
+
34
+ created: int
35
+
36
+ model: str
37
+
38
+ object: Literal["text.completion"]
39
+
40
+ usage: Optional[ChatCompletionUsage] = None
41
+
42
+ prompt: Optional[List[Prompt]] = None
@@ -0,0 +1,66 @@
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.chat_completion_usage import ChatCompletionUsage
9
+
10
+ __all__ = ["CompletionChunk", "Token", "Choice", "ChoiceDelta", "ChoiceDeltaFunctionCall"]
11
+
12
+
13
+ class Token(BaseModel):
14
+ id: int
15
+
16
+ logprob: float
17
+
18
+ special: bool
19
+
20
+ text: str
21
+
22
+
23
+ class ChoiceDeltaFunctionCall(BaseModel):
24
+ arguments: str
25
+
26
+ name: str
27
+
28
+
29
+ class ChoiceDelta(BaseModel):
30
+ role: Literal["system", "user", "assistant", "function", "tool"]
31
+
32
+ content: Optional[str] = None
33
+
34
+ function_call: Optional[ChoiceDeltaFunctionCall] = None
35
+
36
+ reasoning: Optional[str] = None
37
+
38
+ token_id: Optional[int] = None
39
+
40
+ tool_calls: Optional[List[ToolChoice]] = None
41
+
42
+
43
+ class Choice(BaseModel):
44
+ index: int
45
+
46
+ delta: Optional[ChoiceDelta] = None
47
+
48
+ text: Optional[str] = None
49
+
50
+
51
+ class CompletionChunk(BaseModel):
52
+ id: str
53
+
54
+ token: Token
55
+
56
+ choices: List[Choice]
57
+
58
+ finish_reason: Optional[Literal["stop", "eos", "length", "tool_calls", "function_call"]] = None
59
+
60
+ usage: Optional[ChatCompletionUsage] = None
61
+
62
+ created: Optional[int] = None
63
+
64
+ object: Optional[Literal["completion.chunk"]] = None
65
+
66
+ seed: Optional[int] = None
@@ -0,0 +1,138 @@
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
6
+ from typing_extensions import Literal, Required, TypedDict
7
+
8
+ from .._types import SequenceNotStr
9
+
10
+ __all__ = ["CompletionCreateParamsBase", "CompletionCreateParamsNonStreaming", "CompletionCreateParamsStreaming"]
11
+
12
+
13
+ class CompletionCreateParamsBase(TypedDict, total=False):
14
+ model: Required[
15
+ Union[
16
+ Literal[
17
+ "meta-llama/Llama-2-70b-hf",
18
+ "mistralai/Mistral-7B-v0.1",
19
+ "mistralai/Mixtral-8x7B-v0.1",
20
+ "Meta-Llama/Llama-Guard-7b",
21
+ ],
22
+ str,
23
+ ]
24
+ ]
25
+ """The name of the model to query.
26
+
27
+ [See all of Together AI's chat models](https://docs.together.ai/docs/serverless-models#chat-models)
28
+ """
29
+
30
+ prompt: Required[str]
31
+ """A string providing context for the model to complete."""
32
+
33
+ echo: bool
34
+ """If true, the response will contain the prompt.
35
+
36
+ Can be used with `logprobs` to return prompt logprobs.
37
+ """
38
+
39
+ frequency_penalty: float
40
+ """
41
+ A number between -2.0 and 2.0 where a positive value decreases the likelihood of
42
+ repeating tokens that have already been mentioned.
43
+ """
44
+
45
+ logit_bias: Dict[str, float]
46
+ """Adjusts the likelihood of specific tokens appearing in the generated output."""
47
+
48
+ logprobs: int
49
+ """
50
+ An integer between 0 and 20 of the top k tokens to return log probabilities for
51
+ at each generation step, instead of just the sampled token. Log probabilities
52
+ help assess model confidence in token predictions.
53
+ """
54
+
55
+ max_tokens: int
56
+ """The maximum number of tokens to generate."""
57
+
58
+ min_p: float
59
+ """A number between 0 and 1 that can be used as an alternative to top-p and top-k."""
60
+
61
+ n: int
62
+ """The number of completions to generate for each prompt."""
63
+
64
+ presence_penalty: float
65
+ """
66
+ A number between -2.0 and 2.0 where a positive value increases the likelihood of
67
+ a model talking about new topics.
68
+ """
69
+
70
+ repetition_penalty: float
71
+ """
72
+ A number that controls the diversity of generated text by reducing the
73
+ likelihood of repeated sequences. Higher values decrease repetition.
74
+ """
75
+
76
+ safety_model: Union[Literal["Meta-Llama/Llama-Guard-7b"], str]
77
+ """The name of the moderation model used to validate tokens.
78
+
79
+ Choose from the available moderation models found
80
+ [here](https://docs.together.ai/docs/inference-models#moderation-models).
81
+ """
82
+
83
+ seed: int
84
+ """Seed value for reproducibility."""
85
+
86
+ stop: SequenceNotStr[str]
87
+ """A list of string sequences that will truncate (stop) inference text output.
88
+
89
+ For example, "</s>" will stop generation as soon as the model generates the
90
+ given token.
91
+ """
92
+
93
+ temperature: float
94
+ """
95
+ A decimal number from 0-1 that determines the degree of randomness in the
96
+ response. A temperature less than 1 favors more correctness and is appropriate
97
+ for question answering or summarization. A value closer to 1 introduces more
98
+ randomness in the output.
99
+ """
100
+
101
+ top_k: int
102
+ """
103
+ An integer that's used to limit the number of choices for the next predicted
104
+ word or token. It specifies the maximum number of tokens to consider at each
105
+ step, based on their probability of occurrence. This technique helps to speed up
106
+ the generation process and can improve the quality of the generated text by
107
+ focusing on the most likely options.
108
+ """
109
+
110
+ top_p: float
111
+ """
112
+ A percentage (also called the nucleus parameter) that's used to dynamically
113
+ adjust the number of choices for each predicted token based on the cumulative
114
+ probabilities. It specifies a probability threshold below which all less likely
115
+ tokens are filtered out. This technique helps maintain diversity and generate
116
+ more fluent and natural-sounding text.
117
+ """
118
+
119
+
120
+ class CompletionCreateParamsNonStreaming(CompletionCreateParamsBase, total=False):
121
+ stream: Literal[False]
122
+ """
123
+ If true, stream tokens as Server-Sent Events as the model generates them instead
124
+ of waiting for the full model response. The stream terminates with
125
+ `data: [DONE]`. If false, return a single JSON object containing the results.
126
+ """
127
+
128
+
129
+ class CompletionCreateParamsStreaming(CompletionCreateParamsBase):
130
+ stream: Required[Literal[True]]
131
+ """
132
+ If true, stream tokens as Server-Sent Events as the model generates them instead
133
+ of waiting for the full model response. The stream terminates with
134
+ `data: [DONE]`. If false, return a single JSON object containing the results.
135
+ """
136
+
137
+
138
+ CompletionCreateParams = Union[CompletionCreateParamsNonStreaming, CompletionCreateParamsStreaming]