vellum-ai 0.8.5__py3-none-any.whl → 0.8.7__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- vellum/__init__.py +64 -104
- vellum/client.py +39 -17
- vellum/core/client_wrapper.py +1 -1
- vellum/resources/__init__.py +2 -2
- vellum/resources/ad_hoc/client.py +372 -0
- vellum/types/__init__.py +62 -102
- vellum/types/ad_hoc_execute_prompt_event.py +14 -0
- vellum/types/ad_hoc_expand_meta_request.py +33 -0
- vellum/types/ad_hoc_fulfilled_prompt_execution_meta.py +27 -0
- vellum/types/{open_api_const_property_request.py → ad_hoc_initiated_prompt_execution_meta.py} +4 -6
- vellum/types/{open_api_boolean_property_request.py → ad_hoc_rejected_prompt_execution_meta.py} +5 -6
- vellum/types/{tik_token_tokenizer_config_request.py → ad_hoc_streaming_prompt_execution_meta.py} +3 -4
- vellum/types/{open_api_one_of_property.py → chat_message_prompt_block_properties_request.py} +10 -9
- vellum/types/chat_message_prompt_block_request.py +36 -0
- vellum/types/{ml_model_developer_enum_value_label.py → ephemeral_prompt_cache_config_request.py} +4 -5
- vellum/types/ephemeral_prompt_cache_config_type_enum.py +5 -0
- vellum/types/fulfilled_ad_hoc_execute_prompt_event.py +28 -0
- vellum/types/function_definition_prompt_block_properties_request.py +42 -0
- vellum/types/function_definition_prompt_block_request.py +30 -0
- vellum/types/{hugging_face_tokenizer_config.py → initiated_ad_hoc_execute_prompt_event.py} +6 -5
- vellum/types/{ml_model_display_tag_enum_value_label.py → jinja_prompt_block_properties_request.py} +5 -5
- vellum/types/jinja_prompt_block_request.py +30 -0
- vellum/types/ml_model_usage.py +2 -0
- vellum/types/plain_text_prompt_block_request.py +29 -0
- vellum/types/prompt_block_request.py +19 -0
- vellum/types/prompt_block_state.py +5 -0
- vellum/types/{prompt_deployment_expand_meta_request_request.py → prompt_deployment_expand_meta_request.py} +1 -1
- vellum/types/prompt_parameters_request.py +27 -0
- vellum/types/{open_api_boolean_property.py → prompt_request_chat_history_input_request.py} +7 -7
- vellum/types/prompt_request_input_request.py +10 -0
- vellum/types/{hugging_face_tokenizer_config_request.py → prompt_request_json_input_request.py} +6 -6
- vellum/types/{tik_token_tokenizer_config.py → prompt_request_string_input_request.py} +6 -5
- vellum/types/rejected_ad_hoc_execute_prompt_event.py +28 -0
- vellum/types/rich_text_child_block_request.py +7 -0
- vellum/types/rich_text_prompt_block_request.py +30 -0
- vellum/types/streaming_ad_hoc_execute_prompt_event.py +33 -0
- vellum/types/variable_prompt_block_request.py +29 -0
- vellum/types/{ml_model_family_enum_value_label.py → vellum_variable_request.py} +5 -4
- {vellum_ai-0.8.5.dist-info → vellum_ai-0.8.7.dist-info}/METADATA +1 -1
- {vellum_ai-0.8.5.dist-info → vellum_ai-0.8.7.dist-info}/RECORD +43 -63
- vellum/resources/ml_models/client.py +0 -948
- vellum/types/hosted_by_enum.py +0 -26
- vellum/types/ml_model_developer.py +0 -27
- vellum/types/ml_model_display_config_labelled.py +0 -26
- vellum/types/ml_model_display_config_request.py +0 -26
- vellum/types/ml_model_display_tag.py +0 -7
- vellum/types/ml_model_exec_config.py +0 -34
- vellum/types/ml_model_exec_config_request.py +0 -34
- vellum/types/ml_model_family.py +0 -29
- vellum/types/ml_model_feature.py +0 -18
- vellum/types/ml_model_parameter_config.py +0 -32
- vellum/types/ml_model_parameter_config_request.py +0 -32
- vellum/types/ml_model_read.py +0 -92
- vellum/types/ml_model_request_authorization_config.py +0 -20
- vellum/types/ml_model_request_authorization_config_request.py +0 -20
- vellum/types/ml_model_request_authorization_config_type_enum.py +0 -5
- vellum/types/ml_model_request_config.py +0 -22
- vellum/types/ml_model_request_config_request.py +0 -22
- vellum/types/ml_model_response_config.py +0 -21
- vellum/types/ml_model_response_config_request.py +0 -21
- vellum/types/ml_model_tokenizer_config.py +0 -7
- vellum/types/ml_model_tokenizer_config_request.py +0 -7
- vellum/types/open_api_array_property.py +0 -41
- vellum/types/open_api_array_property_request.py +0 -41
- vellum/types/open_api_const_property.py +0 -26
- vellum/types/open_api_integer_property.py +0 -30
- vellum/types/open_api_integer_property_request.py +0 -30
- vellum/types/open_api_number_property.py +0 -31
- vellum/types/open_api_number_property_request.py +0 -31
- vellum/types/open_api_object_property.py +0 -40
- vellum/types/open_api_object_property_request.py +0 -40
- vellum/types/open_api_one_of_property_request.py +0 -33
- vellum/types/open_api_property.py +0 -27
- vellum/types/open_api_property_request.py +0 -27
- vellum/types/open_api_ref_property.py +0 -26
- vellum/types/open_api_ref_property_request.py +0 -26
- vellum/types/open_api_string_property.py +0 -30
- vellum/types/open_api_string_property_request.py +0 -30
- vellum/types/paginated_ml_model_read_list.py +0 -23
- vellum/types/visibility_enum.py +0 -5
- /vellum/resources/{ml_models → ad_hoc}/__init__.py +0 -0
- {vellum_ai-0.8.5.dist-info → vellum_ai-0.8.7.dist-info}/LICENSE +0 -0
- {vellum_ai-0.8.5.dist-info → vellum_ai-0.8.7.dist-info}/WHEEL +0 -0
@@ -1,948 +0,0 @@
|
|
1
|
-
# This file was auto-generated by Fern from our API Definition.
|
2
|
-
|
3
|
-
import typing
|
4
|
-
from ...core.client_wrapper import SyncClientWrapper
|
5
|
-
from ...core.request_options import RequestOptions
|
6
|
-
from ...types.paginated_ml_model_read_list import PaginatedMlModelReadList
|
7
|
-
from ...core.pydantic_utilities import parse_obj_as
|
8
|
-
from json.decoder import JSONDecodeError
|
9
|
-
from ...core.api_error import ApiError
|
10
|
-
from ...types.ml_model_family import MlModelFamily
|
11
|
-
from ...types.hosted_by_enum import HostedByEnum
|
12
|
-
from ...types.ml_model_developer import MlModelDeveloper
|
13
|
-
from ...types.ml_model_exec_config_request import MlModelExecConfigRequest
|
14
|
-
from ...types.ml_model_parameter_config_request import MlModelParameterConfigRequest
|
15
|
-
from ...types.ml_model_display_config_request import MlModelDisplayConfigRequest
|
16
|
-
from ...types.visibility_enum import VisibilityEnum
|
17
|
-
from ...types.ml_model_read import MlModelRead
|
18
|
-
from ...core.jsonable_encoder import jsonable_encoder
|
19
|
-
from ...core.client_wrapper import AsyncClientWrapper
|
20
|
-
|
21
|
-
# this is used as the default value for optional parameters
|
22
|
-
OMIT = typing.cast(typing.Any, ...)
|
23
|
-
|
24
|
-
|
25
|
-
class MlModelsClient:
|
26
|
-
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
27
|
-
self._client_wrapper = client_wrapper
|
28
|
-
|
29
|
-
def list(
|
30
|
-
self,
|
31
|
-
*,
|
32
|
-
limit: typing.Optional[int] = None,
|
33
|
-
offset: typing.Optional[int] = None,
|
34
|
-
ordering: typing.Optional[str] = None,
|
35
|
-
request_options: typing.Optional[RequestOptions] = None,
|
36
|
-
) -> PaginatedMlModelReadList:
|
37
|
-
"""
|
38
|
-
List all ML Models that your Workspace has access to.
|
39
|
-
|
40
|
-
Parameters
|
41
|
-
----------
|
42
|
-
limit : typing.Optional[int]
|
43
|
-
Number of results to return per page.
|
44
|
-
|
45
|
-
offset : typing.Optional[int]
|
46
|
-
The initial index from which to return the results.
|
47
|
-
|
48
|
-
ordering : typing.Optional[str]
|
49
|
-
Which field to use when ordering the results.
|
50
|
-
|
51
|
-
request_options : typing.Optional[RequestOptions]
|
52
|
-
Request-specific configuration.
|
53
|
-
|
54
|
-
Returns
|
55
|
-
-------
|
56
|
-
PaginatedMlModelReadList
|
57
|
-
|
58
|
-
|
59
|
-
Examples
|
60
|
-
--------
|
61
|
-
from vellum import Vellum
|
62
|
-
|
63
|
-
client = Vellum(
|
64
|
-
api_key="YOUR_API_KEY",
|
65
|
-
)
|
66
|
-
client.ml_models.list()
|
67
|
-
"""
|
68
|
-
_response = self._client_wrapper.httpx_client.request(
|
69
|
-
"v1/ml-models",
|
70
|
-
base_url=self._client_wrapper.get_environment().default,
|
71
|
-
method="GET",
|
72
|
-
params={
|
73
|
-
"limit": limit,
|
74
|
-
"offset": offset,
|
75
|
-
"ordering": ordering,
|
76
|
-
},
|
77
|
-
request_options=request_options,
|
78
|
-
)
|
79
|
-
try:
|
80
|
-
if 200 <= _response.status_code < 300:
|
81
|
-
return typing.cast(
|
82
|
-
PaginatedMlModelReadList,
|
83
|
-
parse_obj_as(
|
84
|
-
type_=PaginatedMlModelReadList, # type: ignore
|
85
|
-
object_=_response.json(),
|
86
|
-
),
|
87
|
-
)
|
88
|
-
_response_json = _response.json()
|
89
|
-
except JSONDecodeError:
|
90
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
91
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
92
|
-
|
93
|
-
def create(
|
94
|
-
self,
|
95
|
-
*,
|
96
|
-
name: str,
|
97
|
-
family: MlModelFamily,
|
98
|
-
hosted_by: HostedByEnum,
|
99
|
-
developed_by: MlModelDeveloper,
|
100
|
-
exec_config: MlModelExecConfigRequest,
|
101
|
-
parameter_config: typing.Optional[MlModelParameterConfigRequest] = OMIT,
|
102
|
-
display_config: typing.Optional[MlModelDisplayConfigRequest] = OMIT,
|
103
|
-
visibility: typing.Optional[VisibilityEnum] = OMIT,
|
104
|
-
request_options: typing.Optional[RequestOptions] = None,
|
105
|
-
) -> MlModelRead:
|
106
|
-
"""
|
107
|
-
Creates a new ML Model.
|
108
|
-
|
109
|
-
Parameters
|
110
|
-
----------
|
111
|
-
name : str
|
112
|
-
The unique name of the ML Model.
|
113
|
-
|
114
|
-
family : MlModelFamily
|
115
|
-
The family of the ML Model.
|
116
|
-
|
117
|
-
* `CAPYBARA` - Capybara
|
118
|
-
* `CHAT_GPT` - Chat GPT
|
119
|
-
* `CLAUDE` - Claude
|
120
|
-
* `COHERE` - Cohere
|
121
|
-
* `FALCON` - Falcon
|
122
|
-
* `GEMINI` - Gemini
|
123
|
-
* `GRANITE` - Granite
|
124
|
-
* `GPT3` - GPT-3
|
125
|
-
* `FIREWORKS` - Fireworks
|
126
|
-
* `LLAMA2` - Llama2
|
127
|
-
* `LLAMA3` - Llama3
|
128
|
-
* `MISTRAL` - Mistral
|
129
|
-
* `MPT` - MPT
|
130
|
-
* `OPENCHAT` - OpenChat
|
131
|
-
* `PALM` - PaLM
|
132
|
-
* `SOLAR` - Solar
|
133
|
-
* `TITAN` - Titan
|
134
|
-
* `WIZARD` - Wizard
|
135
|
-
* `YI` - Yi
|
136
|
-
* `ZEPHYR` - Zephyr
|
137
|
-
|
138
|
-
hosted_by : HostedByEnum
|
139
|
-
The organization hosting the ML Model.
|
140
|
-
|
141
|
-
* `ANTHROPIC` - ANTHROPIC
|
142
|
-
* `AWS_BEDROCK` - AWS_BEDROCK
|
143
|
-
* `AZURE_OPENAI` - AZURE_OPENAI
|
144
|
-
* `COHERE` - COHERE
|
145
|
-
* `CUSTOM` - CUSTOM
|
146
|
-
* `FIREWORKS_AI` - FIREWORKS_AI
|
147
|
-
* `GOOGLE` - GOOGLE
|
148
|
-
* `GOOGLE_VERTEX_AI` - GOOGLE_VERTEX_AI
|
149
|
-
* `GROQ` - GROQ
|
150
|
-
* `HUGGINGFACE` - HUGGINGFACE
|
151
|
-
* `IBM_WATSONX` - IBM_WATSONX
|
152
|
-
* `MOSAICML` - MOSAICML
|
153
|
-
* `MYSTIC` - MYSTIC
|
154
|
-
* `OPENAI` - OPENAI
|
155
|
-
* `OPENPIPE` - OPENPIPE
|
156
|
-
* `PYQ` - PYQ
|
157
|
-
* `REPLICATE` - REPLICATE
|
158
|
-
|
159
|
-
developed_by : MlModelDeveloper
|
160
|
-
The organization that developed the ML Model.
|
161
|
-
|
162
|
-
* `01_AI` - 01_AI
|
163
|
-
* `AMAZON` - AMAZON
|
164
|
-
* `ANTHROPIC` - ANTHROPIC
|
165
|
-
* `COHERE` - COHERE
|
166
|
-
* `ELUTHERAI` - ELUTHERAI
|
167
|
-
* `FIREWORKS_AI` - FIREWORKS_AI
|
168
|
-
* `GOOGLE` - GOOGLE
|
169
|
-
* `HUGGINGFACE` - HUGGINGFACE
|
170
|
-
* `IBM` - IBM
|
171
|
-
* `META` - META
|
172
|
-
* `MISTRAL_AI` - MISTRAL_AI
|
173
|
-
* `MOSAICML` - MOSAICML
|
174
|
-
* `NOUS_RESEARCH` - NOUS_RESEARCH
|
175
|
-
* `OPENAI` - OPENAI
|
176
|
-
* `OPENCHAT` - OPENCHAT
|
177
|
-
* `OPENPIPE` - OPENPIPE
|
178
|
-
* `TII` - TII
|
179
|
-
* `WIZARDLM` - WIZARDLM
|
180
|
-
|
181
|
-
exec_config : MlModelExecConfigRequest
|
182
|
-
Configuration for how to execute the ML Model.
|
183
|
-
|
184
|
-
parameter_config : typing.Optional[MlModelParameterConfigRequest]
|
185
|
-
Configuration for the ML Model's parameters.
|
186
|
-
|
187
|
-
display_config : typing.Optional[MlModelDisplayConfigRequest]
|
188
|
-
Configuration for how to display the ML Model.
|
189
|
-
|
190
|
-
visibility : typing.Optional[VisibilityEnum]
|
191
|
-
The visibility of the ML Model.
|
192
|
-
|
193
|
-
* `DEFAULT` - DEFAULT
|
194
|
-
* `PUBLIC` - PUBLIC
|
195
|
-
* `PRIVATE` - PRIVATE
|
196
|
-
* `DISABLED` - DISABLED
|
197
|
-
|
198
|
-
request_options : typing.Optional[RequestOptions]
|
199
|
-
Request-specific configuration.
|
200
|
-
|
201
|
-
Returns
|
202
|
-
-------
|
203
|
-
MlModelRead
|
204
|
-
|
205
|
-
|
206
|
-
Examples
|
207
|
-
--------
|
208
|
-
from vellum import MlModelExecConfigRequest, Vellum
|
209
|
-
|
210
|
-
client = Vellum(
|
211
|
-
api_key="YOUR_API_KEY",
|
212
|
-
)
|
213
|
-
client.ml_models.create(
|
214
|
-
name="name",
|
215
|
-
family="CAPYBARA",
|
216
|
-
hosted_by="ANTHROPIC",
|
217
|
-
developed_by="01_AI",
|
218
|
-
exec_config=MlModelExecConfigRequest(
|
219
|
-
model_identifier="model_identifier",
|
220
|
-
base_url="base_url",
|
221
|
-
metadata={"key": "value"},
|
222
|
-
features=["TEXT"],
|
223
|
-
),
|
224
|
-
)
|
225
|
-
"""
|
226
|
-
_response = self._client_wrapper.httpx_client.request(
|
227
|
-
"v1/ml-models",
|
228
|
-
base_url=self._client_wrapper.get_environment().default,
|
229
|
-
method="POST",
|
230
|
-
json={
|
231
|
-
"name": name,
|
232
|
-
"family": family,
|
233
|
-
"hosted_by": hosted_by,
|
234
|
-
"developed_by": developed_by,
|
235
|
-
"exec_config": exec_config,
|
236
|
-
"parameter_config": parameter_config,
|
237
|
-
"display_config": display_config,
|
238
|
-
"visibility": visibility,
|
239
|
-
},
|
240
|
-
request_options=request_options,
|
241
|
-
omit=OMIT,
|
242
|
-
)
|
243
|
-
try:
|
244
|
-
if 200 <= _response.status_code < 300:
|
245
|
-
return typing.cast(
|
246
|
-
MlModelRead,
|
247
|
-
parse_obj_as(
|
248
|
-
type_=MlModelRead, # type: ignore
|
249
|
-
object_=_response.json(),
|
250
|
-
),
|
251
|
-
)
|
252
|
-
_response_json = _response.json()
|
253
|
-
except JSONDecodeError:
|
254
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
255
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
256
|
-
|
257
|
-
def retrieve(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> MlModelRead:
|
258
|
-
"""
|
259
|
-
Retrieve an ML Model by its UUID.
|
260
|
-
|
261
|
-
Parameters
|
262
|
-
----------
|
263
|
-
id : str
|
264
|
-
Either the ML Model's ID or its unique name
|
265
|
-
|
266
|
-
request_options : typing.Optional[RequestOptions]
|
267
|
-
Request-specific configuration.
|
268
|
-
|
269
|
-
Returns
|
270
|
-
-------
|
271
|
-
MlModelRead
|
272
|
-
|
273
|
-
|
274
|
-
Examples
|
275
|
-
--------
|
276
|
-
from vellum import Vellum
|
277
|
-
|
278
|
-
client = Vellum(
|
279
|
-
api_key="YOUR_API_KEY",
|
280
|
-
)
|
281
|
-
client.ml_models.retrieve(
|
282
|
-
id="id",
|
283
|
-
)
|
284
|
-
"""
|
285
|
-
_response = self._client_wrapper.httpx_client.request(
|
286
|
-
f"v1/ml-models/{jsonable_encoder(id)}",
|
287
|
-
base_url=self._client_wrapper.get_environment().default,
|
288
|
-
method="GET",
|
289
|
-
request_options=request_options,
|
290
|
-
)
|
291
|
-
try:
|
292
|
-
if 200 <= _response.status_code < 300:
|
293
|
-
return typing.cast(
|
294
|
-
MlModelRead,
|
295
|
-
parse_obj_as(
|
296
|
-
type_=MlModelRead, # type: ignore
|
297
|
-
object_=_response.json(),
|
298
|
-
),
|
299
|
-
)
|
300
|
-
_response_json = _response.json()
|
301
|
-
except JSONDecodeError:
|
302
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
303
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
304
|
-
|
305
|
-
def update(
|
306
|
-
self,
|
307
|
-
id: str,
|
308
|
-
*,
|
309
|
-
exec_config: typing.Optional[MlModelExecConfigRequest] = OMIT,
|
310
|
-
parameter_config: typing.Optional[MlModelParameterConfigRequest] = OMIT,
|
311
|
-
display_config: typing.Optional[MlModelDisplayConfigRequest] = OMIT,
|
312
|
-
visibility: typing.Optional[VisibilityEnum] = OMIT,
|
313
|
-
request_options: typing.Optional[RequestOptions] = None,
|
314
|
-
) -> MlModelRead:
|
315
|
-
"""
|
316
|
-
Replace an ML Model with a new representation, keying off of its UUID.
|
317
|
-
|
318
|
-
Parameters
|
319
|
-
----------
|
320
|
-
id : str
|
321
|
-
Either the ML Model's ID or its unique name
|
322
|
-
|
323
|
-
exec_config : typing.Optional[MlModelExecConfigRequest]
|
324
|
-
Configuration for how to execute the ML Model.
|
325
|
-
|
326
|
-
parameter_config : typing.Optional[MlModelParameterConfigRequest]
|
327
|
-
Configuration for the ML Model's parameters.
|
328
|
-
|
329
|
-
display_config : typing.Optional[MlModelDisplayConfigRequest]
|
330
|
-
Configuration for how to display the ML Model.
|
331
|
-
|
332
|
-
visibility : typing.Optional[VisibilityEnum]
|
333
|
-
The visibility of the ML Model.
|
334
|
-
|
335
|
-
* `DEFAULT` - DEFAULT
|
336
|
-
* `PUBLIC` - PUBLIC
|
337
|
-
* `PRIVATE` - PRIVATE
|
338
|
-
* `DISABLED` - DISABLED
|
339
|
-
|
340
|
-
request_options : typing.Optional[RequestOptions]
|
341
|
-
Request-specific configuration.
|
342
|
-
|
343
|
-
Returns
|
344
|
-
-------
|
345
|
-
MlModelRead
|
346
|
-
|
347
|
-
|
348
|
-
Examples
|
349
|
-
--------
|
350
|
-
from vellum import Vellum
|
351
|
-
|
352
|
-
client = Vellum(
|
353
|
-
api_key="YOUR_API_KEY",
|
354
|
-
)
|
355
|
-
client.ml_models.update(
|
356
|
-
id="id",
|
357
|
-
)
|
358
|
-
"""
|
359
|
-
_response = self._client_wrapper.httpx_client.request(
|
360
|
-
f"v1/ml-models/{jsonable_encoder(id)}",
|
361
|
-
base_url=self._client_wrapper.get_environment().default,
|
362
|
-
method="PUT",
|
363
|
-
json={
|
364
|
-
"exec_config": exec_config,
|
365
|
-
"parameter_config": parameter_config,
|
366
|
-
"display_config": display_config,
|
367
|
-
"visibility": visibility,
|
368
|
-
},
|
369
|
-
request_options=request_options,
|
370
|
-
omit=OMIT,
|
371
|
-
)
|
372
|
-
try:
|
373
|
-
if 200 <= _response.status_code < 300:
|
374
|
-
return typing.cast(
|
375
|
-
MlModelRead,
|
376
|
-
parse_obj_as(
|
377
|
-
type_=MlModelRead, # type: ignore
|
378
|
-
object_=_response.json(),
|
379
|
-
),
|
380
|
-
)
|
381
|
-
_response_json = _response.json()
|
382
|
-
except JSONDecodeError:
|
383
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
384
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
385
|
-
|
386
|
-
def partial_update(
|
387
|
-
self,
|
388
|
-
id: str,
|
389
|
-
*,
|
390
|
-
exec_config: typing.Optional[MlModelExecConfigRequest] = OMIT,
|
391
|
-
parameter_config: typing.Optional[MlModelParameterConfigRequest] = OMIT,
|
392
|
-
display_config: typing.Optional[MlModelDisplayConfigRequest] = OMIT,
|
393
|
-
visibility: typing.Optional[VisibilityEnum] = OMIT,
|
394
|
-
request_options: typing.Optional[RequestOptions] = None,
|
395
|
-
) -> MlModelRead:
|
396
|
-
"""
|
397
|
-
Partially update an ML Model, keying off of its UUID.
|
398
|
-
|
399
|
-
Parameters
|
400
|
-
----------
|
401
|
-
id : str
|
402
|
-
Either the ML Model's ID or its unique name
|
403
|
-
|
404
|
-
exec_config : typing.Optional[MlModelExecConfigRequest]
|
405
|
-
Configuration for how to execute the ML Model.
|
406
|
-
|
407
|
-
parameter_config : typing.Optional[MlModelParameterConfigRequest]
|
408
|
-
Configuration for the ML Model's parameters.
|
409
|
-
|
410
|
-
display_config : typing.Optional[MlModelDisplayConfigRequest]
|
411
|
-
Configuration for how to display the ML Model.
|
412
|
-
|
413
|
-
visibility : typing.Optional[VisibilityEnum]
|
414
|
-
The visibility of the ML Model.
|
415
|
-
|
416
|
-
* `DEFAULT` - DEFAULT
|
417
|
-
* `PUBLIC` - PUBLIC
|
418
|
-
* `PRIVATE` - PRIVATE
|
419
|
-
* `DISABLED` - DISABLED
|
420
|
-
|
421
|
-
request_options : typing.Optional[RequestOptions]
|
422
|
-
Request-specific configuration.
|
423
|
-
|
424
|
-
Returns
|
425
|
-
-------
|
426
|
-
MlModelRead
|
427
|
-
|
428
|
-
|
429
|
-
Examples
|
430
|
-
--------
|
431
|
-
from vellum import Vellum
|
432
|
-
|
433
|
-
client = Vellum(
|
434
|
-
api_key="YOUR_API_KEY",
|
435
|
-
)
|
436
|
-
client.ml_models.partial_update(
|
437
|
-
id="id",
|
438
|
-
)
|
439
|
-
"""
|
440
|
-
_response = self._client_wrapper.httpx_client.request(
|
441
|
-
f"v1/ml-models/{jsonable_encoder(id)}",
|
442
|
-
base_url=self._client_wrapper.get_environment().default,
|
443
|
-
method="PATCH",
|
444
|
-
json={
|
445
|
-
"exec_config": exec_config,
|
446
|
-
"parameter_config": parameter_config,
|
447
|
-
"display_config": display_config,
|
448
|
-
"visibility": visibility,
|
449
|
-
},
|
450
|
-
request_options=request_options,
|
451
|
-
omit=OMIT,
|
452
|
-
)
|
453
|
-
try:
|
454
|
-
if 200 <= _response.status_code < 300:
|
455
|
-
return typing.cast(
|
456
|
-
MlModelRead,
|
457
|
-
parse_obj_as(
|
458
|
-
type_=MlModelRead, # type: ignore
|
459
|
-
object_=_response.json(),
|
460
|
-
),
|
461
|
-
)
|
462
|
-
_response_json = _response.json()
|
463
|
-
except JSONDecodeError:
|
464
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
465
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
466
|
-
|
467
|
-
|
468
|
-
class AsyncMlModelsClient:
|
469
|
-
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
470
|
-
self._client_wrapper = client_wrapper
|
471
|
-
|
472
|
-
async def list(
|
473
|
-
self,
|
474
|
-
*,
|
475
|
-
limit: typing.Optional[int] = None,
|
476
|
-
offset: typing.Optional[int] = None,
|
477
|
-
ordering: typing.Optional[str] = None,
|
478
|
-
request_options: typing.Optional[RequestOptions] = None,
|
479
|
-
) -> PaginatedMlModelReadList:
|
480
|
-
"""
|
481
|
-
List all ML Models that your Workspace has access to.
|
482
|
-
|
483
|
-
Parameters
|
484
|
-
----------
|
485
|
-
limit : typing.Optional[int]
|
486
|
-
Number of results to return per page.
|
487
|
-
|
488
|
-
offset : typing.Optional[int]
|
489
|
-
The initial index from which to return the results.
|
490
|
-
|
491
|
-
ordering : typing.Optional[str]
|
492
|
-
Which field to use when ordering the results.
|
493
|
-
|
494
|
-
request_options : typing.Optional[RequestOptions]
|
495
|
-
Request-specific configuration.
|
496
|
-
|
497
|
-
Returns
|
498
|
-
-------
|
499
|
-
PaginatedMlModelReadList
|
500
|
-
|
501
|
-
|
502
|
-
Examples
|
503
|
-
--------
|
504
|
-
import asyncio
|
505
|
-
|
506
|
-
from vellum import AsyncVellum
|
507
|
-
|
508
|
-
client = AsyncVellum(
|
509
|
-
api_key="YOUR_API_KEY",
|
510
|
-
)
|
511
|
-
|
512
|
-
|
513
|
-
async def main() -> None:
|
514
|
-
await client.ml_models.list()
|
515
|
-
|
516
|
-
|
517
|
-
asyncio.run(main())
|
518
|
-
"""
|
519
|
-
_response = await self._client_wrapper.httpx_client.request(
|
520
|
-
"v1/ml-models",
|
521
|
-
base_url=self._client_wrapper.get_environment().default,
|
522
|
-
method="GET",
|
523
|
-
params={
|
524
|
-
"limit": limit,
|
525
|
-
"offset": offset,
|
526
|
-
"ordering": ordering,
|
527
|
-
},
|
528
|
-
request_options=request_options,
|
529
|
-
)
|
530
|
-
try:
|
531
|
-
if 200 <= _response.status_code < 300:
|
532
|
-
return typing.cast(
|
533
|
-
PaginatedMlModelReadList,
|
534
|
-
parse_obj_as(
|
535
|
-
type_=PaginatedMlModelReadList, # type: ignore
|
536
|
-
object_=_response.json(),
|
537
|
-
),
|
538
|
-
)
|
539
|
-
_response_json = _response.json()
|
540
|
-
except JSONDecodeError:
|
541
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
542
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
543
|
-
|
544
|
-
async def create(
|
545
|
-
self,
|
546
|
-
*,
|
547
|
-
name: str,
|
548
|
-
family: MlModelFamily,
|
549
|
-
hosted_by: HostedByEnum,
|
550
|
-
developed_by: MlModelDeveloper,
|
551
|
-
exec_config: MlModelExecConfigRequest,
|
552
|
-
parameter_config: typing.Optional[MlModelParameterConfigRequest] = OMIT,
|
553
|
-
display_config: typing.Optional[MlModelDisplayConfigRequest] = OMIT,
|
554
|
-
visibility: typing.Optional[VisibilityEnum] = OMIT,
|
555
|
-
request_options: typing.Optional[RequestOptions] = None,
|
556
|
-
) -> MlModelRead:
|
557
|
-
"""
|
558
|
-
Creates a new ML Model.
|
559
|
-
|
560
|
-
Parameters
|
561
|
-
----------
|
562
|
-
name : str
|
563
|
-
The unique name of the ML Model.
|
564
|
-
|
565
|
-
family : MlModelFamily
|
566
|
-
The family of the ML Model.
|
567
|
-
|
568
|
-
* `CAPYBARA` - Capybara
|
569
|
-
* `CHAT_GPT` - Chat GPT
|
570
|
-
* `CLAUDE` - Claude
|
571
|
-
* `COHERE` - Cohere
|
572
|
-
* `FALCON` - Falcon
|
573
|
-
* `GEMINI` - Gemini
|
574
|
-
* `GRANITE` - Granite
|
575
|
-
* `GPT3` - GPT-3
|
576
|
-
* `FIREWORKS` - Fireworks
|
577
|
-
* `LLAMA2` - Llama2
|
578
|
-
* `LLAMA3` - Llama3
|
579
|
-
* `MISTRAL` - Mistral
|
580
|
-
* `MPT` - MPT
|
581
|
-
* `OPENCHAT` - OpenChat
|
582
|
-
* `PALM` - PaLM
|
583
|
-
* `SOLAR` - Solar
|
584
|
-
* `TITAN` - Titan
|
585
|
-
* `WIZARD` - Wizard
|
586
|
-
* `YI` - Yi
|
587
|
-
* `ZEPHYR` - Zephyr
|
588
|
-
|
589
|
-
hosted_by : HostedByEnum
|
590
|
-
The organization hosting the ML Model.
|
591
|
-
|
592
|
-
* `ANTHROPIC` - ANTHROPIC
|
593
|
-
* `AWS_BEDROCK` - AWS_BEDROCK
|
594
|
-
* `AZURE_OPENAI` - AZURE_OPENAI
|
595
|
-
* `COHERE` - COHERE
|
596
|
-
* `CUSTOM` - CUSTOM
|
597
|
-
* `FIREWORKS_AI` - FIREWORKS_AI
|
598
|
-
* `GOOGLE` - GOOGLE
|
599
|
-
* `GOOGLE_VERTEX_AI` - GOOGLE_VERTEX_AI
|
600
|
-
* `GROQ` - GROQ
|
601
|
-
* `HUGGINGFACE` - HUGGINGFACE
|
602
|
-
* `IBM_WATSONX` - IBM_WATSONX
|
603
|
-
* `MOSAICML` - MOSAICML
|
604
|
-
* `MYSTIC` - MYSTIC
|
605
|
-
* `OPENAI` - OPENAI
|
606
|
-
* `OPENPIPE` - OPENPIPE
|
607
|
-
* `PYQ` - PYQ
|
608
|
-
* `REPLICATE` - REPLICATE
|
609
|
-
|
610
|
-
developed_by : MlModelDeveloper
|
611
|
-
The organization that developed the ML Model.
|
612
|
-
|
613
|
-
* `01_AI` - 01_AI
|
614
|
-
* `AMAZON` - AMAZON
|
615
|
-
* `ANTHROPIC` - ANTHROPIC
|
616
|
-
* `COHERE` - COHERE
|
617
|
-
* `ELUTHERAI` - ELUTHERAI
|
618
|
-
* `FIREWORKS_AI` - FIREWORKS_AI
|
619
|
-
* `GOOGLE` - GOOGLE
|
620
|
-
* `HUGGINGFACE` - HUGGINGFACE
|
621
|
-
* `IBM` - IBM
|
622
|
-
* `META` - META
|
623
|
-
* `MISTRAL_AI` - MISTRAL_AI
|
624
|
-
* `MOSAICML` - MOSAICML
|
625
|
-
* `NOUS_RESEARCH` - NOUS_RESEARCH
|
626
|
-
* `OPENAI` - OPENAI
|
627
|
-
* `OPENCHAT` - OPENCHAT
|
628
|
-
* `OPENPIPE` - OPENPIPE
|
629
|
-
* `TII` - TII
|
630
|
-
* `WIZARDLM` - WIZARDLM
|
631
|
-
|
632
|
-
exec_config : MlModelExecConfigRequest
|
633
|
-
Configuration for how to execute the ML Model.
|
634
|
-
|
635
|
-
parameter_config : typing.Optional[MlModelParameterConfigRequest]
|
636
|
-
Configuration for the ML Model's parameters.
|
637
|
-
|
638
|
-
display_config : typing.Optional[MlModelDisplayConfigRequest]
|
639
|
-
Configuration for how to display the ML Model.
|
640
|
-
|
641
|
-
visibility : typing.Optional[VisibilityEnum]
|
642
|
-
The visibility of the ML Model.
|
643
|
-
|
644
|
-
* `DEFAULT` - DEFAULT
|
645
|
-
* `PUBLIC` - PUBLIC
|
646
|
-
* `PRIVATE` - PRIVATE
|
647
|
-
* `DISABLED` - DISABLED
|
648
|
-
|
649
|
-
request_options : typing.Optional[RequestOptions]
|
650
|
-
Request-specific configuration.
|
651
|
-
|
652
|
-
Returns
|
653
|
-
-------
|
654
|
-
MlModelRead
|
655
|
-
|
656
|
-
|
657
|
-
Examples
|
658
|
-
--------
|
659
|
-
import asyncio
|
660
|
-
|
661
|
-
from vellum import AsyncVellum, MlModelExecConfigRequest
|
662
|
-
|
663
|
-
client = AsyncVellum(
|
664
|
-
api_key="YOUR_API_KEY",
|
665
|
-
)
|
666
|
-
|
667
|
-
|
668
|
-
async def main() -> None:
|
669
|
-
await client.ml_models.create(
|
670
|
-
name="name",
|
671
|
-
family="CAPYBARA",
|
672
|
-
hosted_by="ANTHROPIC",
|
673
|
-
developed_by="01_AI",
|
674
|
-
exec_config=MlModelExecConfigRequest(
|
675
|
-
model_identifier="model_identifier",
|
676
|
-
base_url="base_url",
|
677
|
-
metadata={"key": "value"},
|
678
|
-
features=["TEXT"],
|
679
|
-
),
|
680
|
-
)
|
681
|
-
|
682
|
-
|
683
|
-
asyncio.run(main())
|
684
|
-
"""
|
685
|
-
_response = await self._client_wrapper.httpx_client.request(
|
686
|
-
"v1/ml-models",
|
687
|
-
base_url=self._client_wrapper.get_environment().default,
|
688
|
-
method="POST",
|
689
|
-
json={
|
690
|
-
"name": name,
|
691
|
-
"family": family,
|
692
|
-
"hosted_by": hosted_by,
|
693
|
-
"developed_by": developed_by,
|
694
|
-
"exec_config": exec_config,
|
695
|
-
"parameter_config": parameter_config,
|
696
|
-
"display_config": display_config,
|
697
|
-
"visibility": visibility,
|
698
|
-
},
|
699
|
-
request_options=request_options,
|
700
|
-
omit=OMIT,
|
701
|
-
)
|
702
|
-
try:
|
703
|
-
if 200 <= _response.status_code < 300:
|
704
|
-
return typing.cast(
|
705
|
-
MlModelRead,
|
706
|
-
parse_obj_as(
|
707
|
-
type_=MlModelRead, # type: ignore
|
708
|
-
object_=_response.json(),
|
709
|
-
),
|
710
|
-
)
|
711
|
-
_response_json = _response.json()
|
712
|
-
except JSONDecodeError:
|
713
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
714
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
715
|
-
|
716
|
-
async def retrieve(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> MlModelRead:
|
717
|
-
"""
|
718
|
-
Retrieve an ML Model by its UUID.
|
719
|
-
|
720
|
-
Parameters
|
721
|
-
----------
|
722
|
-
id : str
|
723
|
-
Either the ML Model's ID or its unique name
|
724
|
-
|
725
|
-
request_options : typing.Optional[RequestOptions]
|
726
|
-
Request-specific configuration.
|
727
|
-
|
728
|
-
Returns
|
729
|
-
-------
|
730
|
-
MlModelRead
|
731
|
-
|
732
|
-
|
733
|
-
Examples
|
734
|
-
--------
|
735
|
-
import asyncio
|
736
|
-
|
737
|
-
from vellum import AsyncVellum
|
738
|
-
|
739
|
-
client = AsyncVellum(
|
740
|
-
api_key="YOUR_API_KEY",
|
741
|
-
)
|
742
|
-
|
743
|
-
|
744
|
-
async def main() -> None:
|
745
|
-
await client.ml_models.retrieve(
|
746
|
-
id="id",
|
747
|
-
)
|
748
|
-
|
749
|
-
|
750
|
-
asyncio.run(main())
|
751
|
-
"""
|
752
|
-
_response = await self._client_wrapper.httpx_client.request(
|
753
|
-
f"v1/ml-models/{jsonable_encoder(id)}",
|
754
|
-
base_url=self._client_wrapper.get_environment().default,
|
755
|
-
method="GET",
|
756
|
-
request_options=request_options,
|
757
|
-
)
|
758
|
-
try:
|
759
|
-
if 200 <= _response.status_code < 300:
|
760
|
-
return typing.cast(
|
761
|
-
MlModelRead,
|
762
|
-
parse_obj_as(
|
763
|
-
type_=MlModelRead, # type: ignore
|
764
|
-
object_=_response.json(),
|
765
|
-
),
|
766
|
-
)
|
767
|
-
_response_json = _response.json()
|
768
|
-
except JSONDecodeError:
|
769
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
770
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
771
|
-
|
772
|
-
async def update(
|
773
|
-
self,
|
774
|
-
id: str,
|
775
|
-
*,
|
776
|
-
exec_config: typing.Optional[MlModelExecConfigRequest] = OMIT,
|
777
|
-
parameter_config: typing.Optional[MlModelParameterConfigRequest] = OMIT,
|
778
|
-
display_config: typing.Optional[MlModelDisplayConfigRequest] = OMIT,
|
779
|
-
visibility: typing.Optional[VisibilityEnum] = OMIT,
|
780
|
-
request_options: typing.Optional[RequestOptions] = None,
|
781
|
-
) -> MlModelRead:
|
782
|
-
"""
|
783
|
-
Replace an ML Model with a new representation, keying off of its UUID.
|
784
|
-
|
785
|
-
Parameters
|
786
|
-
----------
|
787
|
-
id : str
|
788
|
-
Either the ML Model's ID or its unique name
|
789
|
-
|
790
|
-
exec_config : typing.Optional[MlModelExecConfigRequest]
|
791
|
-
Configuration for how to execute the ML Model.
|
792
|
-
|
793
|
-
parameter_config : typing.Optional[MlModelParameterConfigRequest]
|
794
|
-
Configuration for the ML Model's parameters.
|
795
|
-
|
796
|
-
display_config : typing.Optional[MlModelDisplayConfigRequest]
|
797
|
-
Configuration for how to display the ML Model.
|
798
|
-
|
799
|
-
visibility : typing.Optional[VisibilityEnum]
|
800
|
-
The visibility of the ML Model.
|
801
|
-
|
802
|
-
* `DEFAULT` - DEFAULT
|
803
|
-
* `PUBLIC` - PUBLIC
|
804
|
-
* `PRIVATE` - PRIVATE
|
805
|
-
* `DISABLED` - DISABLED
|
806
|
-
|
807
|
-
request_options : typing.Optional[RequestOptions]
|
808
|
-
Request-specific configuration.
|
809
|
-
|
810
|
-
Returns
|
811
|
-
-------
|
812
|
-
MlModelRead
|
813
|
-
|
814
|
-
|
815
|
-
Examples
|
816
|
-
--------
|
817
|
-
import asyncio
|
818
|
-
|
819
|
-
from vellum import AsyncVellum
|
820
|
-
|
821
|
-
client = AsyncVellum(
|
822
|
-
api_key="YOUR_API_KEY",
|
823
|
-
)
|
824
|
-
|
825
|
-
|
826
|
-
async def main() -> None:
|
827
|
-
await client.ml_models.update(
|
828
|
-
id="id",
|
829
|
-
)
|
830
|
-
|
831
|
-
|
832
|
-
asyncio.run(main())
|
833
|
-
"""
|
834
|
-
_response = await self._client_wrapper.httpx_client.request(
|
835
|
-
f"v1/ml-models/{jsonable_encoder(id)}",
|
836
|
-
base_url=self._client_wrapper.get_environment().default,
|
837
|
-
method="PUT",
|
838
|
-
json={
|
839
|
-
"exec_config": exec_config,
|
840
|
-
"parameter_config": parameter_config,
|
841
|
-
"display_config": display_config,
|
842
|
-
"visibility": visibility,
|
843
|
-
},
|
844
|
-
request_options=request_options,
|
845
|
-
omit=OMIT,
|
846
|
-
)
|
847
|
-
try:
|
848
|
-
if 200 <= _response.status_code < 300:
|
849
|
-
return typing.cast(
|
850
|
-
MlModelRead,
|
851
|
-
parse_obj_as(
|
852
|
-
type_=MlModelRead, # type: ignore
|
853
|
-
object_=_response.json(),
|
854
|
-
),
|
855
|
-
)
|
856
|
-
_response_json = _response.json()
|
857
|
-
except JSONDecodeError:
|
858
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
859
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
860
|
-
|
861
|
-
async def partial_update(
|
862
|
-
self,
|
863
|
-
id: str,
|
864
|
-
*,
|
865
|
-
exec_config: typing.Optional[MlModelExecConfigRequest] = OMIT,
|
866
|
-
parameter_config: typing.Optional[MlModelParameterConfigRequest] = OMIT,
|
867
|
-
display_config: typing.Optional[MlModelDisplayConfigRequest] = OMIT,
|
868
|
-
visibility: typing.Optional[VisibilityEnum] = OMIT,
|
869
|
-
request_options: typing.Optional[RequestOptions] = None,
|
870
|
-
) -> MlModelRead:
|
871
|
-
"""
|
872
|
-
Partially update an ML Model, keying off of its UUID.
|
873
|
-
|
874
|
-
Parameters
|
875
|
-
----------
|
876
|
-
id : str
|
877
|
-
Either the ML Model's ID or its unique name
|
878
|
-
|
879
|
-
exec_config : typing.Optional[MlModelExecConfigRequest]
|
880
|
-
Configuration for how to execute the ML Model.
|
881
|
-
|
882
|
-
parameter_config : typing.Optional[MlModelParameterConfigRequest]
|
883
|
-
Configuration for the ML Model's parameters.
|
884
|
-
|
885
|
-
display_config : typing.Optional[MlModelDisplayConfigRequest]
|
886
|
-
Configuration for how to display the ML Model.
|
887
|
-
|
888
|
-
visibility : typing.Optional[VisibilityEnum]
|
889
|
-
The visibility of the ML Model.
|
890
|
-
|
891
|
-
* `DEFAULT` - DEFAULT
|
892
|
-
* `PUBLIC` - PUBLIC
|
893
|
-
* `PRIVATE` - PRIVATE
|
894
|
-
* `DISABLED` - DISABLED
|
895
|
-
|
896
|
-
request_options : typing.Optional[RequestOptions]
|
897
|
-
Request-specific configuration.
|
898
|
-
|
899
|
-
Returns
|
900
|
-
-------
|
901
|
-
MlModelRead
|
902
|
-
|
903
|
-
|
904
|
-
Examples
|
905
|
-
--------
|
906
|
-
import asyncio
|
907
|
-
|
908
|
-
from vellum import AsyncVellum
|
909
|
-
|
910
|
-
client = AsyncVellum(
|
911
|
-
api_key="YOUR_API_KEY",
|
912
|
-
)
|
913
|
-
|
914
|
-
|
915
|
-
async def main() -> None:
|
916
|
-
await client.ml_models.partial_update(
|
917
|
-
id="id",
|
918
|
-
)
|
919
|
-
|
920
|
-
|
921
|
-
asyncio.run(main())
|
922
|
-
"""
|
923
|
-
_response = await self._client_wrapper.httpx_client.request(
|
924
|
-
f"v1/ml-models/{jsonable_encoder(id)}",
|
925
|
-
base_url=self._client_wrapper.get_environment().default,
|
926
|
-
method="PATCH",
|
927
|
-
json={
|
928
|
-
"exec_config": exec_config,
|
929
|
-
"parameter_config": parameter_config,
|
930
|
-
"display_config": display_config,
|
931
|
-
"visibility": visibility,
|
932
|
-
},
|
933
|
-
request_options=request_options,
|
934
|
-
omit=OMIT,
|
935
|
-
)
|
936
|
-
try:
|
937
|
-
if 200 <= _response.status_code < 300:
|
938
|
-
return typing.cast(
|
939
|
-
MlModelRead,
|
940
|
-
parse_obj_as(
|
941
|
-
type_=MlModelRead, # type: ignore
|
942
|
-
object_=_response.json(),
|
943
|
-
),
|
944
|
-
)
|
945
|
-
_response_json = _response.json()
|
946
|
-
except JSONDecodeError:
|
947
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
948
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|