oracle-ads 2.12.11__py3-none-any.whl → 2.13.1__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 (83) hide show
  1. ads/aqua/__init__.py +7 -1
  2. ads/aqua/app.py +41 -27
  3. ads/aqua/client/client.py +48 -11
  4. ads/aqua/common/entities.py +28 -1
  5. ads/aqua/common/enums.py +32 -21
  6. ads/aqua/common/errors.py +3 -4
  7. ads/aqua/common/utils.py +10 -15
  8. ads/aqua/config/container_config.py +203 -0
  9. ads/aqua/config/evaluation/evaluation_service_config.py +5 -181
  10. ads/aqua/constants.py +1 -1
  11. ads/aqua/evaluation/constants.py +7 -7
  12. ads/aqua/evaluation/errors.py +3 -4
  13. ads/aqua/evaluation/evaluation.py +4 -4
  14. ads/aqua/extension/base_handler.py +4 -0
  15. ads/aqua/extension/model_handler.py +41 -27
  16. ads/aqua/extension/models/ws_models.py +5 -6
  17. ads/aqua/finetuning/constants.py +3 -3
  18. ads/aqua/finetuning/finetuning.py +2 -3
  19. ads/aqua/model/constants.py +7 -7
  20. ads/aqua/model/entities.py +2 -3
  21. ads/aqua/model/enums.py +4 -5
  22. ads/aqua/model/model.py +46 -29
  23. ads/aqua/modeldeployment/deployment.py +6 -14
  24. ads/aqua/modeldeployment/entities.py +5 -3
  25. ads/aqua/server/__init__.py +4 -0
  26. ads/aqua/server/__main__.py +24 -0
  27. ads/aqua/server/app.py +47 -0
  28. ads/aqua/server/aqua_spec.yml +1291 -0
  29. ads/aqua/ui.py +5 -199
  30. ads/common/auth.py +50 -28
  31. ads/common/extended_enum.py +52 -44
  32. ads/common/utils.py +91 -11
  33. ads/config.py +3 -0
  34. ads/llm/__init__.py +12 -8
  35. ads/llm/langchain/plugins/embeddings/__init__.py +4 -0
  36. ads/llm/langchain/plugins/embeddings/oci_data_science_model_deployment_endpoint.py +184 -0
  37. ads/llm/langchain/plugins/llms/oci_data_science_model_deployment_endpoint.py +32 -23
  38. ads/model/artifact_downloader.py +6 -4
  39. ads/model/common/utils.py +15 -3
  40. ads/model/datascience_model.py +422 -71
  41. ads/model/generic_model.py +3 -3
  42. ads/model/model_metadata.py +70 -24
  43. ads/model/model_version_set.py +5 -3
  44. ads/model/service/oci_datascience_model.py +487 -17
  45. ads/opctl/anomaly_detection.py +11 -0
  46. ads/opctl/backend/marketplace/helm_helper.py +13 -14
  47. ads/opctl/cli.py +4 -5
  48. ads/opctl/cmds.py +28 -32
  49. ads/opctl/config/merger.py +8 -11
  50. ads/opctl/config/resolver.py +25 -30
  51. ads/opctl/forecast.py +11 -0
  52. ads/opctl/operator/cli.py +9 -9
  53. ads/opctl/operator/common/backend_factory.py +56 -60
  54. ads/opctl/operator/common/const.py +5 -5
  55. ads/opctl/operator/common/utils.py +16 -0
  56. ads/opctl/operator/lowcode/anomaly/const.py +8 -9
  57. ads/opctl/operator/lowcode/common/data.py +5 -2
  58. ads/opctl/operator/lowcode/common/transformations.py +2 -12
  59. ads/opctl/operator/lowcode/feature_store_marketplace/operator_utils.py +43 -48
  60. ads/opctl/operator/lowcode/forecast/__main__.py +5 -5
  61. ads/opctl/operator/lowcode/forecast/const.py +6 -6
  62. ads/opctl/operator/lowcode/forecast/model/arima.py +6 -3
  63. ads/opctl/operator/lowcode/forecast/model/automlx.py +61 -31
  64. ads/opctl/operator/lowcode/forecast/model/base_model.py +66 -40
  65. ads/opctl/operator/lowcode/forecast/model/forecast_datasets.py +79 -13
  66. ads/opctl/operator/lowcode/forecast/model/neuralprophet.py +5 -2
  67. ads/opctl/operator/lowcode/forecast/model/prophet.py +28 -15
  68. ads/opctl/operator/lowcode/forecast/model_evaluator.py +13 -15
  69. ads/opctl/operator/lowcode/forecast/schema.yaml +1 -1
  70. ads/opctl/operator/lowcode/forecast/whatifserve/deployment_manager.py +7 -0
  71. ads/opctl/operator/lowcode/forecast/whatifserve/score.py +19 -11
  72. ads/opctl/operator/lowcode/pii/constant.py +6 -7
  73. ads/opctl/operator/lowcode/recommender/constant.py +12 -7
  74. ads/opctl/operator/runtime/marketplace_runtime.py +4 -10
  75. ads/opctl/operator/runtime/runtime.py +4 -6
  76. ads/pipeline/ads_pipeline_run.py +13 -25
  77. ads/pipeline/visualizer/graph_renderer.py +3 -4
  78. {oracle_ads-2.12.11.dist-info → oracle_ads-2.13.1.dist-info}/METADATA +18 -15
  79. {oracle_ads-2.12.11.dist-info → oracle_ads-2.13.1.dist-info}/RECORD +82 -74
  80. {oracle_ads-2.12.11.dist-info → oracle_ads-2.13.1.dist-info}/WHEEL +1 -1
  81. ads/aqua/config/evaluation/evaluation_service_model_config.py +0 -8
  82. {oracle_ads-2.12.11.dist-info → oracle_ads-2.13.1.dist-info}/entry_points.txt +0 -0
  83. {oracle_ads-2.12.11.dist-info → oracle_ads-2.13.1.dist-info/licenses}/LICENSE.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env python
2
2
 
3
- # Copyright (c) 2022, 2024 Oracle and/or its affiliates.
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
6
  import inspect
@@ -63,7 +63,7 @@ from ads.model.model_introspect import (
63
63
  ModelIntrospect,
64
64
  )
65
65
  from ads.model.model_metadata import (
66
- ExtendedEnumMeta,
66
+ ExtendedEnum,
67
67
  Framework,
68
68
  MetadataCustomCategory,
69
69
  ModelCustomMetadata,
@@ -146,7 +146,7 @@ class ModelDeploymentRuntimeType:
146
146
  CONTAINER = "container"
147
147
 
148
148
 
149
- class DataScienceModelType(str, metaclass=ExtendedEnumMeta):
149
+ class DataScienceModelType(ExtendedEnum):
150
150
  MODEL_DEPLOYMENT = "datasciencemodeldeployment"
151
151
  MODEL = "datasciencemodel"
152
152
 
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env python
2
2
 
3
- # Copyright (c) 2021, 2024 Oracle and/or its affiliates.
3
+ # Copyright (c) 2021, 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
6
  import json
@@ -21,9 +21,10 @@ from oci.util import to_dict
21
21
 
22
22
  from ads.common import logger
23
23
  from ads.common.error import ChangesNotCommitted
24
- from ads.common.extended_enum import ExtendedEnumMeta
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:
@@ -81,28 +82,34 @@ class MetadataDescriptionTooLong(ValueError):
81
82
  )
82
83
 
83
84
 
84
- class MetadataCustomPrintColumns(str, metaclass=ExtendedEnumMeta):
85
+ class MetadataCustomPrintColumns(ExtendedEnum):
85
86
  KEY = "Key"
86
87
  VALUE = "Value"
87
88
  DESCRIPTION = "Description"
88
89
  CATEGORY = "Category"
90
+ HAS_ARTIFACT = "HasArtifact"
89
91
 
90
92
 
91
- class MetadataTaxonomyPrintColumns(str, metaclass=ExtendedEnumMeta):
93
+ class MetadataTaxonomyPrintColumns(ExtendedEnum):
92
94
  KEY = "Key"
93
95
  VALUE = "Value"
96
+ HAS_ARTIFACT = "HasArtifact"
94
97
 
95
98
 
96
- class MetadataTaxonomyKeys(str, metaclass=ExtendedEnumMeta):
99
+ class MetadataTaxonomyKeys(ExtendedEnum):
97
100
  USE_CASE_TYPE = "UseCaseType"
98
101
  FRAMEWORK = "Framework"
99
102
  FRAMEWORK_VERSION = "FrameworkVersion"
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
- class MetadataCustomKeys(str, metaclass=ExtendedEnumMeta):
112
+ class MetadataCustomKeys(ExtendedEnum):
106
113
  SLUG_NAME = "SlugName"
107
114
  CONDA_ENVIRONMENT = "CondaEnvironment"
108
115
  CONDA_ENVIRONMENT_PATH = "CondaEnvironmentPath"
@@ -121,7 +128,7 @@ class MetadataCustomKeys(str, metaclass=ExtendedEnumMeta):
121
128
  MODEL_FILE_NAME = "ModelFileName"
122
129
 
123
130
 
124
- class MetadataCustomCategory(str, metaclass=ExtendedEnumMeta):
131
+ class MetadataCustomCategory(ExtendedEnum):
125
132
  PERFORMANCE = "Performance"
126
133
  TRAINING_PROFILE = "Training Profile"
127
134
  TRAINING_AND_VALIDATION_DATASETS = "Training and Validation Datasets"
@@ -129,7 +136,7 @@ class MetadataCustomCategory(str, metaclass=ExtendedEnumMeta):
129
136
  OTHER = "Other"
130
137
 
131
138
 
132
- class UseCaseType(str, metaclass=ExtendedEnumMeta):
139
+ class UseCaseType(ExtendedEnum):
133
140
  BINARY_CLASSIFICATION = "binary_classification"
134
141
  REGRESSION = "regression"
135
142
  MULTINOMIAL_CLASSIFICATION = "multinomial_classification"
@@ -146,7 +153,7 @@ class UseCaseType(str, metaclass=ExtendedEnumMeta):
146
153
  OTHER = "other"
147
154
 
148
155
 
149
- class Framework(str, metaclass=ExtendedEnumMeta):
156
+ class Framework(ExtendedEnum):
150
157
  SCIKIT_LEARN = "scikit-learn"
151
158
  XGBOOST = "xgboost"
152
159
  TENSORFLOW = "tensorflow"
@@ -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()],
@@ -1509,7 +1547,12 @@ class ModelTaxonomyMetadata(ModelMetadata):
1509
1547
  metadata = cls()
1510
1548
  for oci_item in metadata_list:
1511
1549
  item = ModelTaxonomyMetadataItem._from_oci_metadata(oci_item)
1512
- metadata[item.key].update(value=item.value)
1550
+ if item.key in metadata.keys:
1551
+ metadata[item.key].update(
1552
+ value=item.value, has_artifact=item.has_artifact
1553
+ )
1554
+ else:
1555
+ metadata._items.add(item)
1513
1556
  return metadata
1514
1557
 
1515
1558
  def to_dataframe(self) -> pd.DataFrame:
@@ -1522,7 +1565,7 @@ class ModelTaxonomyMetadata(ModelMetadata):
1522
1565
  """
1523
1566
  return (
1524
1567
  pd.DataFrame(
1525
- ((item.key, item.value) for item in self._items),
1568
+ ((item.key, item.value, item.has_artifact) for item in self._items),
1526
1569
  columns=[value for value in MetadataTaxonomyPrintColumns.values()],
1527
1570
  )
1528
1571
  .sort_values(by=[MetadataTaxonomyPrintColumns.KEY])
@@ -1562,7 +1605,10 @@ class ModelTaxonomyMetadata(ModelMetadata):
1562
1605
  metadata = cls()
1563
1606
  for item in data["data"]:
1564
1607
  item = ModelTaxonomyMetadataItem.from_dict(item)
1565
- metadata[item.key].update(value=item.value)
1608
+ if item.key in metadata.keys:
1609
+ metadata[item.key].update(value=item.value)
1610
+ else:
1611
+ metadata._items.add(item)
1566
1612
  return metadata
1567
1613
 
1568
1614
 
@@ -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