oracle-ads 2.13.1rc0__py3-none-any.whl → 2.13.2rc1__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 (58) hide show
  1. ads/aqua/__init__.py +7 -1
  2. ads/aqua/app.py +24 -23
  3. ads/aqua/client/client.py +48 -11
  4. ads/aqua/common/entities.py +28 -1
  5. ads/aqua/common/enums.py +13 -7
  6. ads/aqua/common/utils.py +8 -13
  7. ads/aqua/config/container_config.py +203 -0
  8. ads/aqua/config/evaluation/evaluation_service_config.py +5 -181
  9. ads/aqua/constants.py +0 -1
  10. ads/aqua/evaluation/evaluation.py +4 -4
  11. ads/aqua/extension/base_handler.py +4 -0
  12. ads/aqua/extension/model_handler.py +19 -28
  13. ads/aqua/finetuning/finetuning.py +2 -3
  14. ads/aqua/model/entities.py +2 -3
  15. ads/aqua/model/model.py +25 -30
  16. ads/aqua/modeldeployment/deployment.py +6 -14
  17. ads/aqua/modeldeployment/entities.py +2 -2
  18. ads/aqua/server/__init__.py +4 -0
  19. ads/aqua/server/__main__.py +24 -0
  20. ads/aqua/server/app.py +47 -0
  21. ads/aqua/server/aqua_spec.yml +1291 -0
  22. ads/aqua/ui.py +5 -199
  23. ads/common/auth.py +20 -11
  24. ads/common/utils.py +91 -11
  25. ads/config.py +3 -0
  26. ads/llm/__init__.py +1 -0
  27. ads/llm/langchain/plugins/llms/oci_data_science_model_deployment_endpoint.py +32 -23
  28. ads/model/artifact_downloader.py +4 -1
  29. ads/model/common/utils.py +15 -3
  30. ads/model/datascience_model.py +339 -8
  31. ads/model/model_metadata.py +54 -14
  32. ads/model/model_version_set.py +5 -3
  33. ads/model/service/oci_datascience_model.py +477 -5
  34. ads/opctl/operator/common/utils.py +16 -0
  35. ads/opctl/operator/lowcode/anomaly/model/base_model.py +3 -3
  36. ads/opctl/operator/lowcode/anomaly/model/randomcutforest.py +1 -1
  37. ads/opctl/operator/lowcode/anomaly/utils.py +1 -1
  38. ads/opctl/operator/lowcode/common/data.py +5 -2
  39. ads/opctl/operator/lowcode/common/transformations.py +7 -13
  40. ads/opctl/operator/lowcode/common/utils.py +7 -2
  41. ads/opctl/operator/lowcode/forecast/model/arima.py +15 -10
  42. ads/opctl/operator/lowcode/forecast/model/automlx.py +39 -9
  43. ads/opctl/operator/lowcode/forecast/model/autots.py +7 -5
  44. ads/opctl/operator/lowcode/forecast/model/base_model.py +135 -110
  45. ads/opctl/operator/lowcode/forecast/model/forecast_datasets.py +30 -14
  46. ads/opctl/operator/lowcode/forecast/model/ml_forecast.py +2 -2
  47. ads/opctl/operator/lowcode/forecast/model/neuralprophet.py +46 -32
  48. ads/opctl/operator/lowcode/forecast/model/prophet.py +82 -29
  49. ads/opctl/operator/lowcode/forecast/model_evaluator.py +142 -62
  50. ads/opctl/operator/lowcode/forecast/operator_config.py +29 -3
  51. ads/opctl/operator/lowcode/forecast/schema.yaml +1 -1
  52. ads/opctl/operator/lowcode/forecast/whatifserve/deployment_manager.py +108 -56
  53. {oracle_ads-2.13.1rc0.dist-info → oracle_ads-2.13.2rc1.dist-info}/METADATA +15 -12
  54. {oracle_ads-2.13.1rc0.dist-info → oracle_ads-2.13.2rc1.dist-info}/RECORD +57 -53
  55. {oracle_ads-2.13.1rc0.dist-info → oracle_ads-2.13.2rc1.dist-info}/WHEEL +1 -1
  56. ads/aqua/config/evaluation/evaluation_service_model_config.py +0 -8
  57. {oracle_ads-2.13.1rc0.dist-info → oracle_ads-2.13.2rc1.dist-info}/entry_points.txt +0 -0
  58. {oracle_ads-2.13.1rc0.dist-info → oracle_ads-2.13.2rc1.dist-info/licenses}/LICENSE.txt +0 -0
@@ -3,7 +3,6 @@
3
3
  # Copyright (c) 2022, 2025 Oracle and/or its affiliates.
4
4
  # Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
5
5
 
6
- import cgi
7
6
  import json
8
7
  import logging
9
8
  import os
@@ -20,12 +19,14 @@ from ads.common import oci_client as oc
20
19
  from ads.common import utils
21
20
  from ads.common.extended_enum import ExtendedEnum
22
21
  from ads.common.object_storage_details import ObjectStorageDetails
22
+ from ads.common.utils import is_path_exists
23
23
  from ads.config import (
24
24
  AQUA_SERVICE_MODELS_BUCKET as SERVICE_MODELS_BUCKET,
25
25
  )
26
26
  from ads.config import (
27
27
  COMPARTMENT_OCID,
28
28
  PROJECT_OCID,
29
+ USER,
29
30
  )
30
31
  from ads.feature_engineering.schema import Schema
31
32
  from ads.jobs.builders.base import Builder
@@ -34,6 +35,7 @@ from ads.model.artifact_downloader import (
34
35
  SmallArtifactDownloader,
35
36
  )
36
37
  from ads.model.artifact_uploader import LargeArtifactUploader, SmallArtifactUploader
38
+ from ads.model.common.utils import MetadataArtifactPathType
37
39
  from ads.model.model_metadata import (
38
40
  MetadataCustomCategory,
39
41
  ModelCustomMetadata,
@@ -42,6 +44,7 @@ from ads.model.model_metadata import (
42
44
  ModelTaxonomyMetadata,
43
45
  )
44
46
  from ads.model.service.oci_datascience_model import (
47
+ ModelMetadataArtifactDetails,
45
48
  ModelProvenanceNotFoundError,
46
49
  OCIDataScienceModel,
47
50
  )
@@ -72,6 +75,11 @@ class BucketNotVersionedError(Exception): # pragma: no cover
72
75
  super().__init__(msg)
73
76
 
74
77
 
78
+ class PathNotFoundError(Exception):
79
+ def __init__(self, msg="The given path doesn't exist."):
80
+ super().__init__(msg)
81
+
82
+
75
83
  class ModelFileDescriptionError(Exception): # pragma: no cover
76
84
  def __init__(self, msg="Model File Description file is not set up."):
77
85
  super().__init__(msg)
@@ -1591,7 +1599,11 @@ class DataScienceModel(Builder):
1591
1599
 
1592
1600
  @classmethod
1593
1601
  def list(
1594
- cls, compartment_id: str = None, project_id: str = None, **kwargs
1602
+ cls,
1603
+ compartment_id: str = None,
1604
+ project_id: str = None,
1605
+ category: str = USER,
1606
+ **kwargs,
1595
1607
  ) -> List["DataScienceModel"]:
1596
1608
  """Lists datascience models in a given compartment.
1597
1609
 
@@ -1601,6 +1613,8 @@ class DataScienceModel(Builder):
1601
1613
  The compartment OCID.
1602
1614
  project_id: (str, optional). Defaults to `None`.
1603
1615
  The project OCID.
1616
+ category: (str, optional). Defaults to `USER`.
1617
+ The category of Model. Allowed values are: "USER", "SERVICE"
1604
1618
  kwargs
1605
1619
  Additional keyword arguments for filtering models.
1606
1620
 
@@ -1612,13 +1626,17 @@ class DataScienceModel(Builder):
1612
1626
  return [
1613
1627
  cls()._update_from_oci_dsc_model(model)
1614
1628
  for model in OCIDataScienceModel.list_resource(
1615
- compartment_id, project_id=project_id, **kwargs
1629
+ compartment_id, project_id=project_id, category=category, **kwargs
1616
1630
  )
1617
1631
  ]
1618
1632
 
1619
1633
  @classmethod
1620
1634
  def list_df(
1621
- cls, compartment_id: str = None, project_id: str = None, **kwargs
1635
+ cls,
1636
+ compartment_id: str = None,
1637
+ project_id: str = None,
1638
+ category: str = USER,
1639
+ **kwargs,
1622
1640
  ) -> "pandas.DataFrame":
1623
1641
  """Lists datascience models in a given compartment.
1624
1642
 
@@ -1628,6 +1646,8 @@ class DataScienceModel(Builder):
1628
1646
  The compartment OCID.
1629
1647
  project_id: (str, optional). Defaults to `None`.
1630
1648
  The project OCID.
1649
+ category: (str, optional). Defaults to `None`.
1650
+ The category of Model.
1631
1651
  kwargs
1632
1652
  Additional keyword arguments for filtering models.
1633
1653
 
@@ -1638,7 +1658,7 @@ class DataScienceModel(Builder):
1638
1658
  """
1639
1659
  records = []
1640
1660
  for model in OCIDataScienceModel.list_resource(
1641
- compartment_id, project_id=project_id, **kwargs
1661
+ compartment_id, project_id=project_id, category=category, **kwargs
1642
1662
  ):
1643
1663
  records.append(
1644
1664
  {
@@ -1776,9 +1796,11 @@ class DataScienceModel(Builder):
1776
1796
  # Update artifact info
1777
1797
  try:
1778
1798
  artifact_info = self.dsc_model.get_artifact_info()
1779
- _, file_name_info = cgi.parse_header(artifact_info["Content-Disposition"])
1799
+ _, file_name_info = utils.parse_content_disposition(
1800
+ artifact_info["Content-Disposition"]
1801
+ )
1780
1802
 
1781
- if self.dsc_model._is_model_by_reference():
1803
+ if self.dsc_model.is_model_created_by_reference():
1782
1804
  _, file_extension = os.path.splitext(file_name_info["filename"])
1783
1805
  if file_extension.lower() == ".json":
1784
1806
  bucket_uri, _ = self._download_file_description_artifact()
@@ -1787,7 +1809,6 @@ class DataScienceModel(Builder):
1787
1809
  self.set_spec(self.CONST_ARTIFACT, file_name_info["filename"])
1788
1810
  except:
1789
1811
  pass
1790
-
1791
1812
  return self
1792
1813
 
1793
1814
  def to_dict(self) -> Dict:
@@ -2213,3 +2234,313 @@ class DataScienceModel(Builder):
2213
2234
  else:
2214
2235
  # model found case
2215
2236
  self.model_file_description["models"].pop(modelSearchIdx)
2237
+
2238
+ def create_custom_metadata_artifact(
2239
+ self,
2240
+ metadata_key_name: str,
2241
+ artifact_path_or_content: str,
2242
+ path_type: MetadataArtifactPathType = MetadataArtifactPathType.LOCAL,
2243
+ ) -> ModelMetadataArtifactDetails:
2244
+ """Creates model custom metadata artifact for specified model.
2245
+
2246
+ Parameters
2247
+ ----------
2248
+ metadata_key_name: str
2249
+ The name of the model custom metadata key
2250
+
2251
+ artifact_path_or_content: str
2252
+ The model custom metadata artifact path to be upload. It can also be the actual content of the custom metadata
2253
+
2254
+ path_type: MetadataArtifactPathType
2255
+ Can be either of MetadataArtifactPathType.LOCAL , MetadataArtifactPathType.OSS , MetadataArtifactPathType.CONTENT
2256
+ Specifies what type of path is to be provided for metadata artifact.
2257
+ Can be either local , oss or the actual content itself
2258
+
2259
+ Returns
2260
+ -------
2261
+ ModelMetadataArtifactDetails
2262
+ The model custom metadata artifact creation info.
2263
+ Example:
2264
+ {
2265
+ 'Date': 'Mon, 02 Dec 2024 06:38:24 GMT',
2266
+ 'opc-request-id': 'E4F7',
2267
+ 'ETag': '77156317-8bb9-4c4a-882b-0d85f8140d93',
2268
+ 'X-Content-Type-Options': 'nosniff',
2269
+ 'Content-Length': '4029958',
2270
+ 'Vary': 'Origin',
2271
+ 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains',
2272
+ 'status': 204
2273
+ }
2274
+
2275
+ """
2276
+ return self.dsc_model.create_custom_metadata_artifact(
2277
+ metadata_key_name=metadata_key_name,
2278
+ artifact_path=artifact_path_or_content,
2279
+ path_type=path_type,
2280
+ )
2281
+
2282
+ def create_defined_metadata_artifact(
2283
+ self,
2284
+ metadata_key_name: str,
2285
+ artifact_path_or_content: str,
2286
+ path_type: MetadataArtifactPathType = MetadataArtifactPathType.LOCAL,
2287
+ ) -> ModelMetadataArtifactDetails:
2288
+ """Creates model defined metadata artifact for specified model.
2289
+
2290
+ Parameters
2291
+ ----------
2292
+ metadata_key_name: str
2293
+ The name of the model defined metadata key
2294
+
2295
+ artifact_path_or_content: str
2296
+ The model defined metadata artifact path to be upload. It can also be the actual content of the defined metadata
2297
+
2298
+ path_type: MetadataArtifactPathType
2299
+ Can be either of MetadataArtifactPathType.LOCAL , MetadataArtifactPathType.OSS , MetadataArtifactPathType.CONTENT
2300
+ Specifies what type of path is to be provided for metadata artifact.
2301
+ Can be either local , oss or the actual content itself
2302
+
2303
+ Returns
2304
+ -------
2305
+ ModelMetadataArtifactDetails
2306
+ The model defined metadata artifact creation info.
2307
+ Example:
2308
+ {
2309
+ 'Date': 'Mon, 02 Dec 2024 06:38:24 GMT',
2310
+ 'opc-request-id': 'E4F7',
2311
+ 'ETag': '77156317-8bb9-4c4a-882b-0d85f8140d93',
2312
+ 'X-Content-Type-Options': 'nosniff',
2313
+ 'Content-Length': '4029958',
2314
+ 'Vary': 'Origin',
2315
+ 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains',
2316
+ 'status': 204
2317
+ }
2318
+
2319
+ """
2320
+ return self.dsc_model.create_defined_metadata_artifact(
2321
+ metadata_key_name=metadata_key_name,
2322
+ artifact_path=artifact_path_or_content,
2323
+ path_type=path_type,
2324
+ )
2325
+
2326
+ def update_custom_metadata_artifact(
2327
+ self,
2328
+ metadata_key_name: str,
2329
+ artifact_path_or_content: str,
2330
+ path_type: MetadataArtifactPathType = MetadataArtifactPathType.LOCAL,
2331
+ ) -> ModelMetadataArtifactDetails:
2332
+ """Update model custom metadata artifact for specified model.
2333
+
2334
+ Parameters
2335
+ ----------
2336
+ metadata_key_name: str
2337
+ The name of the model custom metadata key
2338
+
2339
+ artifact_path_or_content: str
2340
+ The model custom metadata artifact path. It can also be the actual content of the custom metadata
2341
+
2342
+ path_type: MetadataArtifactPathType
2343
+ Can be either of MetadataArtifactPathType.LOCAL , MetadataArtifactPathType.OSS , MetadataArtifactPathType.CONTENT
2344
+ Specifies what type of path is to be provided for metadata artifact.
2345
+ Can be either local , oss or the actual content itself
2346
+
2347
+ Returns
2348
+ -------
2349
+ ModelMetadataArtifactDetails
2350
+ The model custom metadata artifact update info.
2351
+ Example:
2352
+ {
2353
+ 'Date': 'Mon, 02 Dec 2024 06:38:24 GMT',
2354
+ 'opc-request-id': 'E4F7',
2355
+ 'ETag': '77156317-8bb9-4c4a-882b-0d85f8140d93',
2356
+ 'X-Content-Type-Options': 'nosniff',
2357
+ 'Content-Length': '4029958',
2358
+ 'Vary': 'Origin',
2359
+ 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains',
2360
+ 'status': 204
2361
+ }
2362
+
2363
+ """
2364
+ return self.dsc_model.update_custom_metadata_artifact(
2365
+ metadata_key_name=metadata_key_name,
2366
+ artifact_path=artifact_path_or_content,
2367
+ path_type=path_type,
2368
+ )
2369
+
2370
+ def update_defined_metadata_artifact(
2371
+ self,
2372
+ metadata_key_name: str,
2373
+ artifact_path_or_content: str,
2374
+ path_type: MetadataArtifactPathType = MetadataArtifactPathType.LOCAL,
2375
+ ) -> ModelMetadataArtifactDetails:
2376
+ """Update model defined metadata artifact for specified model.
2377
+
2378
+ Parameters
2379
+ ----------
2380
+ metadata_key_name: str
2381
+ The name of the model defined metadata key
2382
+
2383
+ artifact_path_or_content: str
2384
+ The model defined metadata artifact path. It can also be the actual content of the defined metadata
2385
+
2386
+ path_type: MetadataArtifactPathType
2387
+ Can be either of MetadataArtifactPathType.LOCAL , MetadataArtifactPathType.OSS , MetadataArtifactPathType.CONTENT
2388
+ Specifies what type of path is to be provided for metadata artifact.
2389
+ Can be either local , oss or the actual content itself
2390
+
2391
+ Returns
2392
+ -------
2393
+ ModelMetadataArtifactDetails
2394
+ The model defined metadata artifact update info.
2395
+ Example:
2396
+ {
2397
+ 'Date': 'Mon, 02 Dec 2024 06:38:24 GMT',
2398
+ 'opc-request-id': 'E4F7',
2399
+ 'ETag': '77156317-8bb9-4c4a-882b-0d85f8140d93',
2400
+ 'X-Content-Type-Options': 'nosniff',
2401
+ 'Content-Length': '4029958',
2402
+ 'Vary': 'Origin',
2403
+ 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains',
2404
+ 'status': 204
2405
+ }
2406
+
2407
+ """
2408
+ return self.dsc_model.update_defined_metadata_artifact(
2409
+ metadata_key_name=metadata_key_name,
2410
+ artifact_path=artifact_path_or_content,
2411
+ path_type=path_type,
2412
+ )
2413
+
2414
+ def get_custom_metadata_artifact(
2415
+ self, metadata_key_name: str, target_dir: str, override: bool = False
2416
+ ) -> bytes:
2417
+ """Downloads model custom metadata artifact content for specified model metadata key.
2418
+
2419
+ Parameters
2420
+ ----------
2421
+ metadata_key_name: str
2422
+ The name of the custom metadata key of the model
2423
+
2424
+ target_dir: str
2425
+ The local file path where downloaded model custom metadata artifact will be saved.
2426
+
2427
+ override: bool
2428
+ A boolean flag that controls downloaded metadata artifact file overwriting
2429
+ - If True, overwrites the file if it already exists.
2430
+ - If False (default), raises a `FileExistsError` if the file exists.
2431
+ Returns
2432
+ -------
2433
+ bytes
2434
+ File content of the custom metadata artifact
2435
+
2436
+ """
2437
+ if not is_path_exists(target_dir):
2438
+ raise PathNotFoundError(f"Path : {target_dir} does not exist")
2439
+
2440
+ file_content = self.dsc_model.get_custom_metadata_artifact(
2441
+ metadata_key_name=metadata_key_name
2442
+ )
2443
+ artifact_file_path = os.path.join(target_dir, f"{metadata_key_name}")
2444
+
2445
+ if not override and os.path.exists(artifact_file_path):
2446
+ raise FileExistsError(f"File already exists: {artifact_file_path}")
2447
+
2448
+ with open(artifact_file_path, "wb") as _file:
2449
+ _file.write(file_content)
2450
+ logger.debug(f"Artifact downloaded to location - {artifact_file_path}")
2451
+ return file_content
2452
+
2453
+ def get_defined_metadata_artifact(
2454
+ self, metadata_key_name: str, target_dir: str, override: bool = False
2455
+ ) -> bytes:
2456
+ """Downloads model defined metadata artifact content for specified model metadata key.
2457
+
2458
+ Parameters
2459
+ ----------
2460
+ metadata_key_name: str
2461
+ The name of the model metadatum in the metadata.
2462
+
2463
+ target_dir: str
2464
+ The local file path where downloaded model defined metadata artifact will be saved.
2465
+
2466
+ override: bool
2467
+ A boolean flag that controls downloaded metadata artifact file overwriting
2468
+ - If True, overwrites the file if it already exists.
2469
+ - If False (default), raises a `FileExistsError` if the file exists.
2470
+ Returns
2471
+ -------
2472
+ bytes
2473
+ File content of the custom metadata artifact
2474
+
2475
+ """
2476
+ if not is_path_exists(target_dir):
2477
+ raise PathNotFoundError(f"Path : {target_dir} does not exist")
2478
+
2479
+ file_content = self.dsc_model.get_defined_metadata_artifact(
2480
+ metadata_key_name=metadata_key_name
2481
+ )
2482
+ artifact_file_path = os.path.join(target_dir, f"{metadata_key_name}")
2483
+
2484
+ if not override and os.path.exists(artifact_file_path):
2485
+ raise FileExistsError(f"File already exists: {artifact_file_path}")
2486
+
2487
+ with open(artifact_file_path, "wb") as _file:
2488
+ _file.write(file_content)
2489
+ logger.debug(f"Artifact downloaded to location - {artifact_file_path}")
2490
+ return file_content
2491
+
2492
+ def delete_custom_metadata_artifact(
2493
+ self, metadata_key_name: str
2494
+ ) -> ModelMetadataArtifactDetails:
2495
+ """Deletes model custom metadata artifact for specified model metadata key.
2496
+
2497
+ Parameters
2498
+ ----------
2499
+ metadata_key_name: str
2500
+ The name of the model metadatum in the metadata.
2501
+ Returns
2502
+ -------
2503
+ ModelMetadataArtifactDetails
2504
+ The model custom metadata artifact delete call info.
2505
+ Example:
2506
+ {
2507
+ 'Date': 'Mon, 02 Dec 2024 06:38:24 GMT',
2508
+ 'opc-request-id': 'E4F7',
2509
+ 'X-Content-Type-Options': 'nosniff',
2510
+ 'Vary': 'Origin',
2511
+ 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains',
2512
+ 'status': 204
2513
+ }
2514
+
2515
+ """
2516
+ return self.dsc_model.delete_custom_metadata_artifact(
2517
+ metadata_key_name=metadata_key_name
2518
+ )
2519
+
2520
+ def delete_defined_metadata_artifact(
2521
+ self, metadata_key_name: str
2522
+ ) -> ModelMetadataArtifactDetails:
2523
+ """Deletes model defined metadata artifact for specified model metadata key.
2524
+
2525
+ Parameters
2526
+ ----------
2527
+ metadata_key_name: str
2528
+ The name of the model metadatum in the metadata.
2529
+ Returns
2530
+ -------
2531
+ ModelMetadataArtifactDetails
2532
+ The model defined metadata artifact delete call info.
2533
+ Example:
2534
+ {
2535
+ 'Date': 'Mon, 02 Dec 2024 06:38:24 GMT',
2536
+ 'opc-request-id': 'E4F7',
2537
+ 'X-Content-Type-Options': 'nosniff',
2538
+ 'Vary': 'Origin',
2539
+ 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains',
2540
+ 'status': 204
2541
+ }
2542
+
2543
+ """
2544
+ return self.dsc_model.delete_defined_metadata_artifact(
2545
+ metadata_key_name=metadata_key_name
2546
+ )
@@ -24,6 +24,7 @@ from ads.common.error import ChangesNotCommitted
24
24
  from ads.common.extended_enum import ExtendedEnum
25
25
  from ads.common.object_storage_details import ObjectStorageDetails
26
26
  from ads.common.serializer import DataClassSerializable
27
+ from ads.common.utils import parse_bool
27
28
  from ads.dataset import factory
28
29
 
29
30
  try:
@@ -86,11 +87,13 @@ class MetadataCustomPrintColumns(ExtendedEnum):
86
87
  VALUE = "Value"
87
88
  DESCRIPTION = "Description"
88
89
  CATEGORY = "Category"
90
+ HAS_ARTIFACT = "HasArtifact"
89
91
 
90
92
 
91
93
  class MetadataTaxonomyPrintColumns(ExtendedEnum):
92
94
  KEY = "Key"
93
95
  VALUE = "Value"
96
+ HAS_ARTIFACT = "HasArtifact"
94
97
 
95
98
 
96
99
  class MetadataTaxonomyKeys(ExtendedEnum):
@@ -100,6 +103,10 @@ class MetadataTaxonomyKeys(ExtendedEnum):
100
103
  ALGORITHM = "Algorithm"
101
104
  HYPERPARAMETERS = "Hyperparameters"
102
105
  ARTIFACT_TEST_RESULT = "ArtifactTestResults"
106
+ # README = "Readme"
107
+ # LICENSE = "License"
108
+ # DEPLOYMENT_CONFIGURATION = "DeploymentConfiguration"
109
+ # FINETUNE_CONFIGURATION = "FineTuneConfiguration"
103
110
 
104
111
 
105
112
  class MetadataCustomKeys(ExtendedEnum):
@@ -336,13 +343,14 @@ class ModelMetadataItem(ABC):
336
343
  """Creates a new metadata item from the OCI metadata item."""
337
344
  oci_metadata_item = to_dict(oci_metadata_item)
338
345
  key_value_map = {field: oci_metadata_item.get(field) for field in cls._FIELDS}
339
-
340
346
  if isinstance(key_value_map["value"], str):
341
347
  try:
342
348
  key_value_map["value"] = json.loads(oci_metadata_item.get("value"))
349
+ key_value_map["has_artifact"] = parse_bool(
350
+ oci_metadata_item.get("has_artifact")
351
+ )
343
352
  except Exception:
344
353
  pass
345
-
346
354
  return cls(**key_value_map)
347
355
 
348
356
  def __hash__(self):
@@ -398,15 +406,12 @@ class ModelTaxonomyMetadataItem(ModelMetadataItem):
398
406
  Validates metadata item.
399
407
  """
400
408
 
401
- _FIELDS = ["key", "value"]
409
+ _FIELDS = ["key", "value", "has_artifact"]
402
410
 
403
- def __init__(
404
- self,
405
- key: str,
406
- value: str = None,
407
- ):
411
+ def __init__(self, key: str, value: str = None, has_artifact: bool = False):
408
412
  self.key = key
409
413
  self.value = value
414
+ self.has_artifact = has_artifact
410
415
 
411
416
  @property
412
417
  def key(self) -> str:
@@ -432,6 +437,14 @@ class ModelTaxonomyMetadataItem(ModelMetadataItem):
432
437
  raise ValueError("The key cannot be empty.")
433
438
  self._key = key
434
439
 
440
+ @property
441
+ def has_artifact(self) -> bool:
442
+ return self._has_artifact
443
+
444
+ @has_artifact.setter
445
+ def has_artifact(self, has_artifact: bool):
446
+ self._has_artifact = has_artifact is True
447
+
435
448
  @property
436
449
  def value(self) -> str:
437
450
  return self._value
@@ -471,7 +484,7 @@ class ModelTaxonomyMetadataItem(ModelMetadataItem):
471
484
  """
472
485
  self.update(value=None)
473
486
 
474
- def update(self, value: str) -> None:
487
+ def update(self, value: str, has_artifact: bool = False) -> None:
475
488
  """Updates metadata item value.
476
489
 
477
490
  Parameters
@@ -485,6 +498,7 @@ class ModelTaxonomyMetadataItem(ModelMetadataItem):
485
498
  Nothing.
486
499
  """
487
500
  self.value = value
501
+ self.has_artifact = has_artifact
488
502
 
489
503
  def validate(self) -> bool:
490
504
  """Validates metadata item.
@@ -555,7 +569,7 @@ class ModelCustomMetadataItem(ModelTaxonomyMetadataItem):
555
569
  Validates metadata item.
556
570
  """
557
571
 
558
- _FIELDS = ["key", "value", "description", "category"]
572
+ _FIELDS = ["key", "value", "description", "category", "has_artifact"]
559
573
 
560
574
  def __init__(
561
575
  self,
@@ -563,10 +577,12 @@ class ModelCustomMetadataItem(ModelTaxonomyMetadataItem):
563
577
  value: str = None,
564
578
  description: str = None,
565
579
  category: str = None,
580
+ has_artifact: bool = False,
566
581
  ):
567
582
  super().__init__(key=key, value=value)
568
583
  self.description = description
569
584
  self.category = category
585
+ self.has_artifact = has_artifact
570
586
 
571
587
  @property
572
588
  def description(self) -> str:
@@ -586,6 +602,17 @@ class ModelCustomMetadataItem(ModelTaxonomyMetadataItem):
586
602
 
587
603
  self._description = description
588
604
 
605
+ @property
606
+ def has_artifact(self) -> bool:
607
+ return self._has_artifact
608
+
609
+ @has_artifact.setter
610
+ def has_artifact(self, has_artifact: bool):
611
+ if not has_artifact:
612
+ self._has_artifact = False
613
+ else:
614
+ self._has_artifact = has_artifact
615
+
589
616
  @property
590
617
  def category(self) -> str:
591
618
  return self._category
@@ -631,7 +658,9 @@ class ModelCustomMetadataItem(ModelTaxonomyMetadataItem):
631
658
  """
632
659
  self.update(value=None, description=None, category=None)
633
660
 
634
- def update(self, value: str, description: str, category: str) -> None:
661
+ def update(
662
+ self, value: str, description: str, category: str, has_artifact: bool = False
663
+ ) -> None:
635
664
  """Updates metadata item.
636
665
 
637
666
  Parameters
@@ -651,6 +680,7 @@ class ModelCustomMetadataItem(ModelTaxonomyMetadataItem):
651
680
  self.value = value
652
681
  self.description = description
653
682
  self.category = category
683
+ self.has_artifact = has_artifact
654
684
 
655
685
  def _to_oci_metadata(self):
656
686
  """Converts metadata item to OCI metadata item."""
@@ -659,6 +689,8 @@ class ModelCustomMetadataItem(ModelTaxonomyMetadataItem):
659
689
  oci_metadata_item.value = _METADATA_EMPTY_VALUE
660
690
  if not oci_metadata_item.category:
661
691
  oci_metadata_item.category = MetadataCustomCategory.OTHER
692
+ if not oci_metadata_item.has_artifact:
693
+ oci_metadata_item.has_artifact = False
662
694
  return oci_metadata_item
663
695
 
664
696
  def validate(self) -> bool:
@@ -1368,7 +1400,13 @@ class ModelCustomMetadata(ModelMetadata):
1368
1400
  return (
1369
1401
  pd.DataFrame(
1370
1402
  (
1371
- (item.key, item.value, item.description, item.category)
1403
+ (
1404
+ item.key,
1405
+ item.value,
1406
+ item.description,
1407
+ item.category,
1408
+ item.has_artifact,
1409
+ )
1372
1410
  for item in self._items
1373
1411
  ),
1374
1412
  columns=[value for value in MetadataCustomPrintColumns.values()],
@@ -1510,7 +1548,9 @@ class ModelTaxonomyMetadata(ModelMetadata):
1510
1548
  for oci_item in metadata_list:
1511
1549
  item = ModelTaxonomyMetadataItem._from_oci_metadata(oci_item)
1512
1550
  if item.key in metadata.keys:
1513
- metadata[item.key].update(value=item.value)
1551
+ metadata[item.key].update(
1552
+ value=item.value, has_artifact=item.has_artifact
1553
+ )
1514
1554
  else:
1515
1555
  metadata._items.add(item)
1516
1556
  return metadata
@@ -1525,7 +1565,7 @@ class ModelTaxonomyMetadata(ModelMetadata):
1525
1565
  """
1526
1566
  return (
1527
1567
  pd.DataFrame(
1528
- ((item.key, item.value) for item in self._items),
1568
+ ((item.key, item.value, item.has_artifact) for item in self._items),
1529
1569
  columns=[value for value in MetadataTaxonomyPrintColumns.values()],
1530
1570
  )
1531
1571
  .sort_values(by=[MetadataTaxonomyPrintColumns.KEY])
@@ -14,7 +14,7 @@ from typing import Dict, List, Optional, Union
14
14
 
15
15
  import oci.data_science
16
16
  from ads.common.utils import batch_convert_case, get_value, snake_to_camel
17
- from ads.config import COMPARTMENT_OCID, OCI_REGION_METADATA, PROJECT_OCID
17
+ from ads.config import COMPARTMENT_OCID, OCI_REGION_METADATA, PROJECT_OCID, USER
18
18
  from ads.jobs.builders.base import Builder
19
19
  from ads.model.datascience_model import DataScienceModel
20
20
  from ads.model.service.oci_datascience_model_version_set import (
@@ -454,7 +454,7 @@ class ModelVersionSet(Builder):
454
454
  return "modelVersionSet"
455
455
 
456
456
  @classmethod
457
- def list(cls, compartment_id: str = None, **kwargs) -> List["ModelVersionSet"]:
457
+ def list(cls, compartment_id: str = None, category: str = USER, **kwargs) -> List["ModelVersionSet"]:
458
458
  """
459
459
  List model version sets in a given compartment.
460
460
 
@@ -462,6 +462,8 @@ class ModelVersionSet(Builder):
462
462
  ----------
463
463
  compartment_id: str
464
464
  The OCID of compartment.
465
+ category: (str, optional). Defaults to `USER`.
466
+ The category of Model. Allowed values are: "USER", "SERVICE"
465
467
  kwargs
466
468
  Additional keyword arguments for filtering model version sets.
467
469
 
@@ -473,7 +475,7 @@ class ModelVersionSet(Builder):
473
475
  return [
474
476
  cls.from_dsc_model_version_set(model_version_set)
475
477
  for model_version_set in DataScienceModelVersionSet.list_resource(
476
- compartment_id, **kwargs
478
+ compartment_id, category=category, **kwargs
477
479
  )
478
480
  ]
479
481