truefoundry 0.5.0rc5__py3-none-any.whl → 0.5.0rc6__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.
Potentially problematic release.
This version of truefoundry might be problematic. Click here for more details.
- truefoundry/ml/autogen/client/__init__.py +0 -4
- truefoundry/ml/autogen/client/api/deprecated_api.py +340 -7
- truefoundry/ml/autogen/client/api/mlfoundry_artifacts_api.py +0 -322
- truefoundry/ml/autogen/client/api_client.py +8 -1
- truefoundry/ml/autogen/client/models/__init__.py +0 -4
- truefoundry/ml/autogen/client/models/add_features_to_model_version_request_dto.py +3 -17
- truefoundry/ml/autogen/client/models/agent.py +1 -1
- truefoundry/ml/autogen/client/models/agent_app.py +1 -1
- truefoundry/ml/autogen/client/models/agent_open_api_tool.py +1 -1
- truefoundry/ml/autogen/client/models/agent_open_api_tool_with_fqn.py +1 -1
- truefoundry/ml/autogen/client/models/agent_with_fqn.py +1 -1
- truefoundry/ml/autogen/client/models/artifact_version_manifest.py +1 -1
- truefoundry/ml/autogen/client/models/assistant_message.py +1 -1
- truefoundry/ml/autogen/client/models/blob_storage_reference.py +1 -1
- truefoundry/ml/autogen/client/models/chat_prompt.py +1 -1
- truefoundry/ml/autogen/client/models/external_artifact_source.py +1 -1
- truefoundry/ml/autogen/client/models/fast_ai_framework.py +1 -1
- truefoundry/ml/autogen/client/models/gluon_framework.py +1 -1
- truefoundry/ml/autogen/client/models/h2_o_framework.py +1 -1
- truefoundry/ml/autogen/client/models/image_content_part.py +1 -1
- truefoundry/ml/autogen/client/models/keras_framework.py +1 -1
- truefoundry/ml/autogen/client/models/light_gbm_framework.py +1 -1
- truefoundry/ml/autogen/client/models/model_version_dto.py +7 -8
- truefoundry/ml/autogen/client/models/model_version_manifest.py +1 -1
- truefoundry/ml/autogen/client/models/onnx_framework.py +1 -1
- truefoundry/ml/autogen/client/models/paddle_framework.py +1 -1
- truefoundry/ml/autogen/client/models/py_torch_framework.py +1 -1
- truefoundry/ml/autogen/client/models/sklearn_framework.py +1 -1
- truefoundry/ml/autogen/client/models/spa_cy_framework.py +1 -1
- truefoundry/ml/autogen/client/models/stats_models_framework.py +1 -1
- truefoundry/ml/autogen/client/models/system_message.py +1 -1
- truefoundry/ml/autogen/client/models/tensor_flow_framework.py +1 -1
- truefoundry/ml/autogen/client/models/text_content_part.py +1 -1
- truefoundry/ml/autogen/client/models/transformers_framework.py +1 -1
- truefoundry/ml/autogen/client/models/true_foundry_artifact_source.py +1 -1
- truefoundry/ml/autogen/client/models/update_model_version_request_dto.py +1 -13
- truefoundry/ml/autogen/client/models/user_message.py +1 -1
- truefoundry/ml/autogen/client/models/xg_boost_framework.py +1 -1
- truefoundry/ml/autogen/client_README.md +4 -8
- truefoundry/ml/autogen/models/__init__.py +4 -0
- truefoundry/ml/autogen/models/exceptions.py +30 -0
- truefoundry/ml/autogen/models/schema.py +1547 -0
- truefoundry/ml/autogen/models/signature.py +139 -0
- truefoundry/ml/autogen/models/utils.py +699 -0
- {truefoundry-0.5.0rc5.dist-info → truefoundry-0.5.0rc6.dist-info}/METADATA +1 -1
- {truefoundry-0.5.0rc5.dist-info → truefoundry-0.5.0rc6.dist-info}/RECORD +48 -47
- truefoundry/ml/autogen/client/models/feature_dto.py +0 -68
- truefoundry/ml/autogen/client/models/feature_value_type.py +0 -35
- truefoundry/ml/autogen/client/models/model_schema_dto.py +0 -85
- truefoundry/ml/autogen/client/models/prediction_type.py +0 -34
- {truefoundry-0.5.0rc5.dist-info → truefoundry-0.5.0rc6.dist-info}/WHEEL +0 -0
- {truefoundry-0.5.0rc5.dist-info → truefoundry-0.5.0rc6.dist-info}/entry_points.txt +0 -0
|
@@ -20,12 +20,6 @@ from truefoundry.ml.autogen.client.exceptions import ( # noqa: F401
|
|
|
20
20
|
ApiTypeError,
|
|
21
21
|
ApiValueError,
|
|
22
22
|
)
|
|
23
|
-
from truefoundry.ml.autogen.client.models.add_custom_metrics_to_model_version_request_dto import (
|
|
24
|
-
AddCustomMetricsToModelVersionRequestDto,
|
|
25
|
-
)
|
|
26
|
-
from truefoundry.ml.autogen.client.models.add_features_to_model_version_request_dto import (
|
|
27
|
-
AddFeaturesToModelVersionRequestDto,
|
|
28
|
-
)
|
|
29
23
|
from truefoundry.ml.autogen.client.models.artifact_response_dto import (
|
|
30
24
|
ArtifactResponseDto,
|
|
31
25
|
)
|
|
@@ -189,322 +183,6 @@ class MlfoundryArtifactsApi:
|
|
|
189
183
|
api_client = ApiClient.get_default()
|
|
190
184
|
self.api_client = api_client
|
|
191
185
|
|
|
192
|
-
@validate_arguments
|
|
193
|
-
def add_custom_metrics_to_model_version_post(
|
|
194
|
-
self,
|
|
195
|
-
add_custom_metrics_to_model_version_request_dto: AddCustomMetricsToModelVersionRequestDto,
|
|
196
|
-
**kwargs,
|
|
197
|
-
) -> ModelVersionResponseDto: # noqa: E501
|
|
198
|
-
"""Add Custom Metrics To Model Version # noqa: E501
|
|
199
|
-
|
|
200
|
-
This method makes a synchronous HTTP request by default. To make an
|
|
201
|
-
asynchronous HTTP request, please pass async_req=True
|
|
202
|
-
|
|
203
|
-
>>> thread = api.add_custom_metrics_to_model_version_post(add_custom_metrics_to_model_version_request_dto, async_req=True)
|
|
204
|
-
>>> result = thread.get()
|
|
205
|
-
|
|
206
|
-
:param add_custom_metrics_to_model_version_request_dto: (required)
|
|
207
|
-
:type add_custom_metrics_to_model_version_request_dto: AddCustomMetricsToModelVersionRequestDto
|
|
208
|
-
:param async_req: Whether to execute the request asynchronously.
|
|
209
|
-
:type async_req: bool, optional
|
|
210
|
-
:param _request_timeout: timeout setting for this request.
|
|
211
|
-
If one number provided, it will be total request
|
|
212
|
-
timeout. It can also be a pair (tuple) of
|
|
213
|
-
(connection, read) timeouts.
|
|
214
|
-
:return: Returns the result object.
|
|
215
|
-
If the method is called asynchronously,
|
|
216
|
-
returns the request thread.
|
|
217
|
-
:rtype: ModelVersionResponseDto
|
|
218
|
-
"""
|
|
219
|
-
kwargs["_return_http_data_only"] = True
|
|
220
|
-
if "_preload_content" in kwargs:
|
|
221
|
-
message = "Error! Please call the add_custom_metrics_to_model_version_post_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501
|
|
222
|
-
raise ValueError(message)
|
|
223
|
-
return self.add_custom_metrics_to_model_version_post_with_http_info(
|
|
224
|
-
add_custom_metrics_to_model_version_request_dto, **kwargs
|
|
225
|
-
) # noqa: E501
|
|
226
|
-
|
|
227
|
-
@validate_arguments
|
|
228
|
-
def add_custom_metrics_to_model_version_post_with_http_info(
|
|
229
|
-
self,
|
|
230
|
-
add_custom_metrics_to_model_version_request_dto: AddCustomMetricsToModelVersionRequestDto,
|
|
231
|
-
**kwargs,
|
|
232
|
-
) -> ApiResponse: # noqa: E501
|
|
233
|
-
"""Add Custom Metrics To Model Version # noqa: E501
|
|
234
|
-
|
|
235
|
-
This method makes a synchronous HTTP request by default. To make an
|
|
236
|
-
asynchronous HTTP request, please pass async_req=True
|
|
237
|
-
|
|
238
|
-
>>> thread = api.add_custom_metrics_to_model_version_post_with_http_info(add_custom_metrics_to_model_version_request_dto, async_req=True)
|
|
239
|
-
>>> result = thread.get()
|
|
240
|
-
|
|
241
|
-
:param add_custom_metrics_to_model_version_request_dto: (required)
|
|
242
|
-
:type add_custom_metrics_to_model_version_request_dto: AddCustomMetricsToModelVersionRequestDto
|
|
243
|
-
:param async_req: Whether to execute the request asynchronously.
|
|
244
|
-
:type async_req: bool, optional
|
|
245
|
-
:param _preload_content: if False, the ApiResponse.data will
|
|
246
|
-
be set to none and raw_data will store the
|
|
247
|
-
HTTP response body without reading/decoding.
|
|
248
|
-
Default is True.
|
|
249
|
-
:type _preload_content: bool, optional
|
|
250
|
-
:param _return_http_data_only: response data instead of ApiResponse
|
|
251
|
-
object with status code, headers, etc
|
|
252
|
-
:type _return_http_data_only: bool, optional
|
|
253
|
-
:param _request_timeout: timeout setting for this request. If one
|
|
254
|
-
number provided, it will be total request
|
|
255
|
-
timeout. It can also be a pair (tuple) of
|
|
256
|
-
(connection, read) timeouts.
|
|
257
|
-
:param _request_auth: set to override the auth_settings for an a single
|
|
258
|
-
request; this effectively ignores the authentication
|
|
259
|
-
in the spec for a single request.
|
|
260
|
-
:type _request_auth: dict, optional
|
|
261
|
-
:type _content_type: string, optional: force content-type for the request
|
|
262
|
-
:return: Returns the result object.
|
|
263
|
-
If the method is called asynchronously,
|
|
264
|
-
returns the request thread.
|
|
265
|
-
:rtype: tuple(ModelVersionResponseDto, status_code(int), headers(HTTPHeaderDict))
|
|
266
|
-
"""
|
|
267
|
-
|
|
268
|
-
_params = locals()
|
|
269
|
-
|
|
270
|
-
_all_params = ["add_custom_metrics_to_model_version_request_dto"]
|
|
271
|
-
_all_params.extend(
|
|
272
|
-
[
|
|
273
|
-
"async_req",
|
|
274
|
-
"_return_http_data_only",
|
|
275
|
-
"_preload_content",
|
|
276
|
-
"_request_timeout",
|
|
277
|
-
"_request_auth",
|
|
278
|
-
"_content_type",
|
|
279
|
-
"_headers",
|
|
280
|
-
]
|
|
281
|
-
)
|
|
282
|
-
|
|
283
|
-
# validate the arguments
|
|
284
|
-
for _key, _val in _params["kwargs"].items():
|
|
285
|
-
if _key not in _all_params:
|
|
286
|
-
raise ApiTypeError(
|
|
287
|
-
"Got an unexpected keyword argument '%s'"
|
|
288
|
-
" to method add_custom_metrics_to_model_version_post" % _key
|
|
289
|
-
)
|
|
290
|
-
_params[_key] = _val
|
|
291
|
-
del _params["kwargs"]
|
|
292
|
-
|
|
293
|
-
_collection_formats = {}
|
|
294
|
-
|
|
295
|
-
# process the path parameters
|
|
296
|
-
_path_params = {}
|
|
297
|
-
|
|
298
|
-
# process the query parameters
|
|
299
|
-
_query_params = []
|
|
300
|
-
# process the header parameters
|
|
301
|
-
_header_params = dict(_params.get("_headers", {}))
|
|
302
|
-
# process the form parameters
|
|
303
|
-
_form_params = []
|
|
304
|
-
_files = {}
|
|
305
|
-
# process the body parameter
|
|
306
|
-
_body_params = None
|
|
307
|
-
if _params["add_custom_metrics_to_model_version_request_dto"] is not None:
|
|
308
|
-
_body_params = _params["add_custom_metrics_to_model_version_request_dto"]
|
|
309
|
-
|
|
310
|
-
# set the HTTP header `Accept`
|
|
311
|
-
_header_params["Accept"] = self.api_client.select_header_accept(
|
|
312
|
-
["application/json"]
|
|
313
|
-
) # noqa: E501
|
|
314
|
-
|
|
315
|
-
# set the HTTP header `Content-Type`
|
|
316
|
-
_content_types_list = _params.get(
|
|
317
|
-
"_content_type",
|
|
318
|
-
self.api_client.select_header_content_type(["application/json"]),
|
|
319
|
-
)
|
|
320
|
-
if _content_types_list:
|
|
321
|
-
_header_params["Content-Type"] = _content_types_list
|
|
322
|
-
|
|
323
|
-
# authentication setting
|
|
324
|
-
_auth_settings = ["HTTPBearer", "APIKeyCookie"] # noqa: E501
|
|
325
|
-
|
|
326
|
-
_response_types_map = {
|
|
327
|
-
"200": "ModelVersionResponseDto",
|
|
328
|
-
"422": "HTTPValidationError",
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
return self.api_client.call_api(
|
|
332
|
-
"/api/2.0/mlflow/mlfoundry-artifacts/model-versions/custom-metrics/add",
|
|
333
|
-
"POST",
|
|
334
|
-
_path_params,
|
|
335
|
-
_query_params,
|
|
336
|
-
_header_params,
|
|
337
|
-
body=_body_params,
|
|
338
|
-
post_params=_form_params,
|
|
339
|
-
files=_files,
|
|
340
|
-
response_types_map=_response_types_map,
|
|
341
|
-
auth_settings=_auth_settings,
|
|
342
|
-
async_req=_params.get("async_req"),
|
|
343
|
-
_return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501
|
|
344
|
-
_preload_content=_params.get("_preload_content", True),
|
|
345
|
-
_request_timeout=_params.get("_request_timeout"),
|
|
346
|
-
collection_formats=_collection_formats,
|
|
347
|
-
_request_auth=_params.get("_request_auth"),
|
|
348
|
-
)
|
|
349
|
-
|
|
350
|
-
@validate_arguments
|
|
351
|
-
def add_features_to_model_version_post(
|
|
352
|
-
self,
|
|
353
|
-
add_features_to_model_version_request_dto: AddFeaturesToModelVersionRequestDto,
|
|
354
|
-
**kwargs,
|
|
355
|
-
) -> ModelVersionResponseDto: # noqa: E501
|
|
356
|
-
"""Add Features To Model Version # noqa: E501
|
|
357
|
-
|
|
358
|
-
This method makes a synchronous HTTP request by default. To make an
|
|
359
|
-
asynchronous HTTP request, please pass async_req=True
|
|
360
|
-
|
|
361
|
-
>>> thread = api.add_features_to_model_version_post(add_features_to_model_version_request_dto, async_req=True)
|
|
362
|
-
>>> result = thread.get()
|
|
363
|
-
|
|
364
|
-
:param add_features_to_model_version_request_dto: (required)
|
|
365
|
-
:type add_features_to_model_version_request_dto: AddFeaturesToModelVersionRequestDto
|
|
366
|
-
:param async_req: Whether to execute the request asynchronously.
|
|
367
|
-
:type async_req: bool, optional
|
|
368
|
-
:param _request_timeout: timeout setting for this request.
|
|
369
|
-
If one number provided, it will be total request
|
|
370
|
-
timeout. It can also be a pair (tuple) of
|
|
371
|
-
(connection, read) timeouts.
|
|
372
|
-
:return: Returns the result object.
|
|
373
|
-
If the method is called asynchronously,
|
|
374
|
-
returns the request thread.
|
|
375
|
-
:rtype: ModelVersionResponseDto
|
|
376
|
-
"""
|
|
377
|
-
kwargs["_return_http_data_only"] = True
|
|
378
|
-
if "_preload_content" in kwargs:
|
|
379
|
-
message = "Error! Please call the add_features_to_model_version_post_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501
|
|
380
|
-
raise ValueError(message)
|
|
381
|
-
return self.add_features_to_model_version_post_with_http_info(
|
|
382
|
-
add_features_to_model_version_request_dto, **kwargs
|
|
383
|
-
) # noqa: E501
|
|
384
|
-
|
|
385
|
-
@validate_arguments
|
|
386
|
-
def add_features_to_model_version_post_with_http_info(
|
|
387
|
-
self,
|
|
388
|
-
add_features_to_model_version_request_dto: AddFeaturesToModelVersionRequestDto,
|
|
389
|
-
**kwargs,
|
|
390
|
-
) -> ApiResponse: # noqa: E501
|
|
391
|
-
"""Add Features To Model Version # noqa: E501
|
|
392
|
-
|
|
393
|
-
This method makes a synchronous HTTP request by default. To make an
|
|
394
|
-
asynchronous HTTP request, please pass async_req=True
|
|
395
|
-
|
|
396
|
-
>>> thread = api.add_features_to_model_version_post_with_http_info(add_features_to_model_version_request_dto, async_req=True)
|
|
397
|
-
>>> result = thread.get()
|
|
398
|
-
|
|
399
|
-
:param add_features_to_model_version_request_dto: (required)
|
|
400
|
-
:type add_features_to_model_version_request_dto: AddFeaturesToModelVersionRequestDto
|
|
401
|
-
:param async_req: Whether to execute the request asynchronously.
|
|
402
|
-
:type async_req: bool, optional
|
|
403
|
-
:param _preload_content: if False, the ApiResponse.data will
|
|
404
|
-
be set to none and raw_data will store the
|
|
405
|
-
HTTP response body without reading/decoding.
|
|
406
|
-
Default is True.
|
|
407
|
-
:type _preload_content: bool, optional
|
|
408
|
-
:param _return_http_data_only: response data instead of ApiResponse
|
|
409
|
-
object with status code, headers, etc
|
|
410
|
-
:type _return_http_data_only: bool, optional
|
|
411
|
-
:param _request_timeout: timeout setting for this request. If one
|
|
412
|
-
number provided, it will be total request
|
|
413
|
-
timeout. It can also be a pair (tuple) of
|
|
414
|
-
(connection, read) timeouts.
|
|
415
|
-
:param _request_auth: set to override the auth_settings for an a single
|
|
416
|
-
request; this effectively ignores the authentication
|
|
417
|
-
in the spec for a single request.
|
|
418
|
-
:type _request_auth: dict, optional
|
|
419
|
-
:type _content_type: string, optional: force content-type for the request
|
|
420
|
-
:return: Returns the result object.
|
|
421
|
-
If the method is called asynchronously,
|
|
422
|
-
returns the request thread.
|
|
423
|
-
:rtype: tuple(ModelVersionResponseDto, status_code(int), headers(HTTPHeaderDict))
|
|
424
|
-
"""
|
|
425
|
-
|
|
426
|
-
_params = locals()
|
|
427
|
-
|
|
428
|
-
_all_params = ["add_features_to_model_version_request_dto"]
|
|
429
|
-
_all_params.extend(
|
|
430
|
-
[
|
|
431
|
-
"async_req",
|
|
432
|
-
"_return_http_data_only",
|
|
433
|
-
"_preload_content",
|
|
434
|
-
"_request_timeout",
|
|
435
|
-
"_request_auth",
|
|
436
|
-
"_content_type",
|
|
437
|
-
"_headers",
|
|
438
|
-
]
|
|
439
|
-
)
|
|
440
|
-
|
|
441
|
-
# validate the arguments
|
|
442
|
-
for _key, _val in _params["kwargs"].items():
|
|
443
|
-
if _key not in _all_params:
|
|
444
|
-
raise ApiTypeError(
|
|
445
|
-
"Got an unexpected keyword argument '%s'"
|
|
446
|
-
" to method add_features_to_model_version_post" % _key
|
|
447
|
-
)
|
|
448
|
-
_params[_key] = _val
|
|
449
|
-
del _params["kwargs"]
|
|
450
|
-
|
|
451
|
-
_collection_formats = {}
|
|
452
|
-
|
|
453
|
-
# process the path parameters
|
|
454
|
-
_path_params = {}
|
|
455
|
-
|
|
456
|
-
# process the query parameters
|
|
457
|
-
_query_params = []
|
|
458
|
-
# process the header parameters
|
|
459
|
-
_header_params = dict(_params.get("_headers", {}))
|
|
460
|
-
# process the form parameters
|
|
461
|
-
_form_params = []
|
|
462
|
-
_files = {}
|
|
463
|
-
# process the body parameter
|
|
464
|
-
_body_params = None
|
|
465
|
-
if _params["add_features_to_model_version_request_dto"] is not None:
|
|
466
|
-
_body_params = _params["add_features_to_model_version_request_dto"]
|
|
467
|
-
|
|
468
|
-
# set the HTTP header `Accept`
|
|
469
|
-
_header_params["Accept"] = self.api_client.select_header_accept(
|
|
470
|
-
["application/json"]
|
|
471
|
-
) # noqa: E501
|
|
472
|
-
|
|
473
|
-
# set the HTTP header `Content-Type`
|
|
474
|
-
_content_types_list = _params.get(
|
|
475
|
-
"_content_type",
|
|
476
|
-
self.api_client.select_header_content_type(["application/json"]),
|
|
477
|
-
)
|
|
478
|
-
if _content_types_list:
|
|
479
|
-
_header_params["Content-Type"] = _content_types_list
|
|
480
|
-
|
|
481
|
-
# authentication setting
|
|
482
|
-
_auth_settings = ["HTTPBearer", "APIKeyCookie"] # noqa: E501
|
|
483
|
-
|
|
484
|
-
_response_types_map = {
|
|
485
|
-
"200": "ModelVersionResponseDto",
|
|
486
|
-
"422": "HTTPValidationError",
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
return self.api_client.call_api(
|
|
490
|
-
"/api/2.0/mlflow/mlfoundry-artifacts/model-versions/features/add",
|
|
491
|
-
"POST",
|
|
492
|
-
_path_params,
|
|
493
|
-
_query_params,
|
|
494
|
-
_header_params,
|
|
495
|
-
body=_body_params,
|
|
496
|
-
post_params=_form_params,
|
|
497
|
-
files=_files,
|
|
498
|
-
response_types_map=_response_types_map,
|
|
499
|
-
auth_settings=_auth_settings,
|
|
500
|
-
async_req=_params.get("async_req"),
|
|
501
|
-
_return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501
|
|
502
|
-
_preload_content=_params.get("_preload_content", True),
|
|
503
|
-
_request_timeout=_params.get("_request_timeout"),
|
|
504
|
-
collection_formats=_collection_formats,
|
|
505
|
-
_request_auth=_params.get("_request_auth"),
|
|
506
|
-
)
|
|
507
|
-
|
|
508
186
|
@validate_arguments
|
|
509
187
|
def authorize_user_for_model_post(
|
|
510
188
|
self,
|
|
@@ -28,6 +28,7 @@ from truefoundry.ml.autogen.client import rest
|
|
|
28
28
|
from truefoundry.ml.autogen.client.api_response import ApiResponse
|
|
29
29
|
from truefoundry.ml.autogen.client.configuration import Configuration
|
|
30
30
|
from truefoundry.ml.autogen.client.exceptions import ApiException, ApiValueError
|
|
31
|
+
from truefoundry.pydantic_v1 import SecretStr
|
|
31
32
|
|
|
32
33
|
|
|
33
34
|
class ApiClient:
|
|
@@ -288,6 +289,7 @@ class ApiClient:
|
|
|
288
289
|
"""Builds a JSON POST object.
|
|
289
290
|
|
|
290
291
|
If obj is None, return None.
|
|
292
|
+
If obj is SecretStr, return obj.get_secret_value()
|
|
291
293
|
If obj is str, int, long, float, bool, return directly.
|
|
292
294
|
If obj is datetime.datetime, datetime.date
|
|
293
295
|
convert to string in iso8601 format.
|
|
@@ -300,6 +302,8 @@ class ApiClient:
|
|
|
300
302
|
"""
|
|
301
303
|
if obj is None:
|
|
302
304
|
return None
|
|
305
|
+
elif isinstance(obj, SecretStr):
|
|
306
|
+
return obj.get_secret_value()
|
|
303
307
|
elif isinstance(obj, self.PRIMITIVE_TYPES):
|
|
304
308
|
return obj
|
|
305
309
|
elif isinstance(obj, list):
|
|
@@ -317,7 +321,10 @@ class ApiClient:
|
|
|
317
321
|
# and attributes which value is not None.
|
|
318
322
|
# Convert attribute name to json key in
|
|
319
323
|
# model definition for request.
|
|
320
|
-
|
|
324
|
+
if hasattr(obj, "to_dict") and callable(obj.to_dict):
|
|
325
|
+
obj_dict = obj.to_dict()
|
|
326
|
+
else:
|
|
327
|
+
obj_dict = obj.__dict__
|
|
321
328
|
|
|
322
329
|
return {
|
|
323
330
|
key: self.sanitize_for_serialization(val) for key, val in obj_dict.items()
|
|
@@ -147,8 +147,6 @@ from truefoundry.ml.autogen.client.models.external_artifact_source import (
|
|
|
147
147
|
ExternalArtifactSource,
|
|
148
148
|
)
|
|
149
149
|
from truefoundry.ml.autogen.client.models.fast_ai_framework import FastAIFramework
|
|
150
|
-
from truefoundry.ml.autogen.client.models.feature_dto import FeatureDto
|
|
151
|
-
from truefoundry.ml.autogen.client.models.feature_value_type import FeatureValueType
|
|
152
150
|
from truefoundry.ml.autogen.client.models.file_info_dto import FileInfoDto
|
|
153
151
|
from truefoundry.ml.autogen.client.models.finalize_artifact_version_request_dto import (
|
|
154
152
|
FinalizeArtifactVersionRequestDto,
|
|
@@ -284,7 +282,6 @@ from truefoundry.ml.autogen.client.models.mime_type import MimeType
|
|
|
284
282
|
from truefoundry.ml.autogen.client.models.model_configuration import ModelConfiguration
|
|
285
283
|
from truefoundry.ml.autogen.client.models.model_dto import ModelDto
|
|
286
284
|
from truefoundry.ml.autogen.client.models.model_response_dto import ModelResponseDto
|
|
287
|
-
from truefoundry.ml.autogen.client.models.model_schema_dto import ModelSchemaDto
|
|
288
285
|
from truefoundry.ml.autogen.client.models.model_version_dto import ModelVersionDto
|
|
289
286
|
from truefoundry.ml.autogen.client.models.model_version_manifest import (
|
|
290
287
|
ModelVersionManifest,
|
|
@@ -309,7 +306,6 @@ from truefoundry.ml.autogen.client.models.openapi_spec import OpenapiSpec
|
|
|
309
306
|
from truefoundry.ml.autogen.client.models.paddle_framework import PaddleFramework
|
|
310
307
|
from truefoundry.ml.autogen.client.models.param_dto import ParamDto
|
|
311
308
|
from truefoundry.ml.autogen.client.models.parameters import Parameters
|
|
312
|
-
from truefoundry.ml.autogen.client.models.prediction_type import PredictionType
|
|
313
309
|
from truefoundry.ml.autogen.client.models.py_torch_framework import PyTorchFramework
|
|
314
310
|
from truefoundry.ml.autogen.client.models.resolve_agent_app_response_dto import (
|
|
315
311
|
ResolveAgentAppResponseDto,
|
|
@@ -16,8 +16,8 @@ from __future__ import annotations
|
|
|
16
16
|
import json
|
|
17
17
|
import pprint
|
|
18
18
|
import re # noqa: F401
|
|
19
|
+
from typing import Any, Dict, Optional
|
|
19
20
|
|
|
20
|
-
from truefoundry.ml.autogen.client.models.feature_dto import FeatureDto
|
|
21
21
|
from truefoundry.pydantic_v1 import BaseModel, Field, StrictStr, conlist
|
|
22
22
|
|
|
23
23
|
|
|
@@ -27,7 +27,7 @@ class AddFeaturesToModelVersionRequestDto(BaseModel):
|
|
|
27
27
|
"""
|
|
28
28
|
|
|
29
29
|
id: StrictStr = Field(...)
|
|
30
|
-
features: conlist(
|
|
30
|
+
features: Optional[conlist(Dict[str, Any])] = None
|
|
31
31
|
__properties = ["id", "features"]
|
|
32
32
|
|
|
33
33
|
class Config:
|
|
@@ -52,13 +52,6 @@ class AddFeaturesToModelVersionRequestDto(BaseModel):
|
|
|
52
52
|
def to_dict(self):
|
|
53
53
|
"""Returns the dictionary representation of the model using alias"""
|
|
54
54
|
_dict = self.dict(by_alias=True, exclude={}, exclude_none=True)
|
|
55
|
-
# override the default output from truefoundry.pydantic_v1 by calling `to_dict()` of each item in features (list)
|
|
56
|
-
_items = []
|
|
57
|
-
if self.features:
|
|
58
|
-
for _item in self.features:
|
|
59
|
-
if _item:
|
|
60
|
-
_items.append(_item.to_dict())
|
|
61
|
-
_dict["features"] = _items
|
|
62
55
|
return _dict
|
|
63
56
|
|
|
64
57
|
@classmethod
|
|
@@ -71,13 +64,6 @@ class AddFeaturesToModelVersionRequestDto(BaseModel):
|
|
|
71
64
|
return AddFeaturesToModelVersionRequestDto.parse_obj(obj)
|
|
72
65
|
|
|
73
66
|
_obj = AddFeaturesToModelVersionRequestDto.parse_obj(
|
|
74
|
-
{
|
|
75
|
-
"id": obj.get("id"),
|
|
76
|
-
"features": [
|
|
77
|
-
FeatureDto.from_dict(_item) for _item in obj.get("features")
|
|
78
|
-
]
|
|
79
|
-
if obj.get("features") is not None
|
|
80
|
-
else None,
|
|
81
|
-
}
|
|
67
|
+
{"id": obj.get("id"), "features": obj.get("features")}
|
|
82
68
|
)
|
|
83
69
|
return _obj
|
|
@@ -64,7 +64,7 @@ class AgentOpenAPIToolWithFQN(BaseModel):
|
|
|
64
64
|
@validator("type")
|
|
65
65
|
def type_validate_enum(cls, value):
|
|
66
66
|
"""Validates the enum"""
|
|
67
|
-
if value not in ("openapi-tool"):
|
|
67
|
+
if value not in ("openapi-tool",):
|
|
68
68
|
raise ValueError("must be one of enum values ('openapi-tool')")
|
|
69
69
|
return value
|
|
70
70
|
|
|
@@ -37,7 +37,7 @@ class AssistantMessage(BaseModel):
|
|
|
37
37
|
@validator("role")
|
|
38
38
|
def role_validate_enum(cls, value):
|
|
39
39
|
"""Validates the enum"""
|
|
40
|
-
if value not in ("assistant"):
|
|
40
|
+
if value not in ("assistant",):
|
|
41
41
|
raise ValueError("must be one of enum values ('assistant')")
|
|
42
42
|
return value
|
|
43
43
|
|
|
@@ -39,7 +39,7 @@ class BlobStorageReference(BaseModel):
|
|
|
39
39
|
@validator("type")
|
|
40
40
|
def type_validate_enum(cls, value):
|
|
41
41
|
"""Validates the enum"""
|
|
42
|
-
if value not in ("blob-storage"):
|
|
42
|
+
if value not in ("blob-storage",):
|
|
43
43
|
raise ValueError("must be one of enum values ('blob-storage')")
|
|
44
44
|
return value
|
|
45
45
|
|
|
@@ -37,7 +37,7 @@ class ExternalArtifactSource(BaseModel):
|
|
|
37
37
|
@validator("type")
|
|
38
38
|
def type_validate_enum(cls, value):
|
|
39
39
|
"""Validates the enum"""
|
|
40
|
-
if value not in ("external"):
|
|
40
|
+
if value not in ("external",):
|
|
41
41
|
raise ValueError("must be one of enum values ('external')")
|
|
42
42
|
return value
|
|
43
43
|
|
|
@@ -34,7 +34,7 @@ class FastAIFramework(BaseModel):
|
|
|
34
34
|
@validator("type")
|
|
35
35
|
def type_validate_enum(cls, value):
|
|
36
36
|
"""Validates the enum"""
|
|
37
|
-
if value not in ("fastai"):
|
|
37
|
+
if value not in ("fastai",):
|
|
38
38
|
raise ValueError("must be one of enum values ('fastai')")
|
|
39
39
|
return value
|
|
40
40
|
|
|
@@ -33,7 +33,7 @@ class GluonFramework(BaseModel):
|
|
|
33
33
|
@validator("type")
|
|
34
34
|
def type_validate_enum(cls, value):
|
|
35
35
|
"""Validates the enum"""
|
|
36
|
-
if value not in ("gluon"):
|
|
36
|
+
if value not in ("gluon",):
|
|
37
37
|
raise ValueError("must be one of enum values ('gluon')")
|
|
38
38
|
return value
|
|
39
39
|
|
|
@@ -36,7 +36,7 @@ class ImageContentPart(BaseModel):
|
|
|
36
36
|
@validator("type")
|
|
37
37
|
def type_validate_enum(cls, value):
|
|
38
38
|
"""Validates the enum"""
|
|
39
|
-
if value not in ("image_url"):
|
|
39
|
+
if value not in ("image_url",):
|
|
40
40
|
raise ValueError("must be one of enum values ('image_url')")
|
|
41
41
|
return value
|
|
42
42
|
|
|
@@ -33,7 +33,7 @@ class KerasFramework(BaseModel):
|
|
|
33
33
|
@validator("type")
|
|
34
34
|
def type_validate_enum(cls, value):
|
|
35
35
|
"""Validates the enum"""
|
|
36
|
-
if value not in ("keras"):
|
|
36
|
+
if value not in ("keras",):
|
|
37
37
|
raise ValueError("must be one of enum values ('keras')")
|
|
38
38
|
return value
|
|
39
39
|
|
|
@@ -34,7 +34,7 @@ class LightGBMFramework(BaseModel):
|
|
|
34
34
|
@validator("type")
|
|
35
35
|
def type_validate_enum(cls, value):
|
|
36
36
|
"""Validates the enum"""
|
|
37
|
-
if value not in ("lightgbm"):
|
|
37
|
+
if value not in ("lightgbm",):
|
|
38
38
|
raise ValueError("must be one of enum values ('lightgbm')")
|
|
39
39
|
return value
|
|
40
40
|
|