oracle-ads 2.12.10rc0__py3-none-any.whl → 2.13.0__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 (66) hide show
  1. ads/aqua/__init__.py +2 -1
  2. ads/aqua/app.py +46 -19
  3. ads/aqua/client/__init__.py +3 -0
  4. ads/aqua/client/client.py +799 -0
  5. ads/aqua/common/enums.py +19 -14
  6. ads/aqua/common/errors.py +3 -4
  7. ads/aqua/common/utils.py +2 -2
  8. ads/aqua/constants.py +1 -0
  9. ads/aqua/evaluation/constants.py +7 -7
  10. ads/aqua/evaluation/errors.py +3 -4
  11. ads/aqua/evaluation/evaluation.py +20 -12
  12. ads/aqua/extension/aqua_ws_msg_handler.py +14 -7
  13. ads/aqua/extension/base_handler.py +12 -9
  14. ads/aqua/extension/model_handler.py +29 -1
  15. ads/aqua/extension/models/ws_models.py +5 -6
  16. ads/aqua/finetuning/constants.py +3 -3
  17. ads/aqua/finetuning/entities.py +3 -0
  18. ads/aqua/finetuning/finetuning.py +32 -1
  19. ads/aqua/model/constants.py +7 -7
  20. ads/aqua/model/entities.py +2 -1
  21. ads/aqua/model/enums.py +4 -5
  22. ads/aqua/model/model.py +158 -76
  23. ads/aqua/modeldeployment/deployment.py +22 -10
  24. ads/aqua/modeldeployment/entities.py +3 -1
  25. ads/cli.py +16 -8
  26. ads/common/auth.py +33 -20
  27. ads/common/extended_enum.py +52 -44
  28. ads/llm/__init__.py +11 -8
  29. ads/llm/langchain/plugins/embeddings/__init__.py +4 -0
  30. ads/llm/langchain/plugins/embeddings/oci_data_science_model_deployment_endpoint.py +184 -0
  31. ads/model/artifact_downloader.py +3 -4
  32. ads/model/datascience_model.py +84 -64
  33. ads/model/generic_model.py +3 -3
  34. ads/model/model_metadata.py +17 -11
  35. ads/model/service/oci_datascience_model.py +12 -14
  36. ads/opctl/backend/marketplace/helm_helper.py +13 -14
  37. ads/opctl/cli.py +4 -5
  38. ads/opctl/cmds.py +28 -32
  39. ads/opctl/config/merger.py +8 -11
  40. ads/opctl/config/resolver.py +25 -30
  41. ads/opctl/operator/cli.py +9 -9
  42. ads/opctl/operator/common/backend_factory.py +56 -60
  43. ads/opctl/operator/common/const.py +5 -5
  44. ads/opctl/operator/lowcode/anomaly/const.py +8 -9
  45. ads/opctl/operator/lowcode/common/transformations.py +38 -3
  46. ads/opctl/operator/lowcode/common/utils.py +11 -1
  47. ads/opctl/operator/lowcode/feature_store_marketplace/operator_utils.py +43 -48
  48. ads/opctl/operator/lowcode/forecast/__main__.py +10 -0
  49. ads/opctl/operator/lowcode/forecast/const.py +6 -6
  50. ads/opctl/operator/lowcode/forecast/model/forecast_datasets.py +1 -1
  51. ads/opctl/operator/lowcode/forecast/operator_config.py +31 -0
  52. ads/opctl/operator/lowcode/forecast/schema.yaml +63 -0
  53. ads/opctl/operator/lowcode/forecast/whatifserve/__init__.py +7 -0
  54. ads/opctl/operator/lowcode/forecast/whatifserve/deployment_manager.py +233 -0
  55. ads/opctl/operator/lowcode/forecast/whatifserve/score.py +238 -0
  56. ads/opctl/operator/lowcode/pii/constant.py +6 -7
  57. ads/opctl/operator/lowcode/recommender/constant.py +12 -7
  58. ads/opctl/operator/runtime/marketplace_runtime.py +4 -10
  59. ads/opctl/operator/runtime/runtime.py +4 -6
  60. ads/pipeline/ads_pipeline_run.py +13 -25
  61. ads/pipeline/visualizer/graph_renderer.py +3 -4
  62. {oracle_ads-2.12.10rc0.dist-info → oracle_ads-2.13.0.dist-info}/METADATA +4 -2
  63. {oracle_ads-2.12.10rc0.dist-info → oracle_ads-2.13.0.dist-info}/RECORD +66 -59
  64. {oracle_ads-2.12.10rc0.dist-info → oracle_ads-2.13.0.dist-info}/LICENSE.txt +0 -0
  65. {oracle_ads-2.12.10rc0.dist-info → oracle_ads-2.13.0.dist-info}/WHEEL +0 -0
  66. {oracle_ads-2.12.10rc0.dist-info → oracle_ads-2.13.0.dist-info}/entry_points.txt +0 -0
ads/aqua/__init__.py CHANGED
@@ -6,7 +6,8 @@
6
6
  import os
7
7
  from logging import getLogger
8
8
 
9
- from ads import set_auth
9
+ from ads import logger, set_auth
10
+ from ads.aqua.client.client import AsyncClient, Client
10
11
  from ads.aqua.common.utils import fetch_service_compartment
11
12
  from ads.config import OCI_RESOURCE_PRINCIPAL_VERSION
12
13
 
ads/aqua/app.py CHANGED
@@ -1,18 +1,19 @@
1
1
  #!/usr/bin/env python
2
- # Copyright (c) 2024 Oracle and/or its affiliates.
2
+ # Copyright (c) 2024, 2025 Oracle and/or its affiliates.
3
3
  # Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
4
4
 
5
5
  import json
6
6
  import os
7
+ import traceback
7
8
  from dataclasses import fields
8
- from typing import Dict, Union
9
+ from typing import Dict, Optional, Union
9
10
 
10
11
  import oci
11
12
  from oci.data_science.models import UpdateModelDetails, UpdateModelProvenanceDetails
12
13
 
13
14
  from ads import set_auth
14
15
  from ads.aqua import logger
15
- from ads.aqua.common.enums import Tags
16
+ from ads.aqua.common.enums import ConfigFolder, Tags
16
17
  from ads.aqua.common.errors import AquaRuntimeError, AquaValueError
17
18
  from ads.aqua.common.utils import (
18
19
  _is_valid_mvs,
@@ -23,7 +24,7 @@ from ads.aqua.common.utils import (
23
24
  from ads.aqua.constants import UNKNOWN
24
25
  from ads.common import oci_client as oc
25
26
  from ads.common.auth import default_signer
26
- from ads.common.utils import extract_region
27
+ from ads.common.utils import extract_region, is_path_exists
27
28
  from ads.config import (
28
29
  AQUA_TELEMETRY_BUCKET,
29
30
  AQUA_TELEMETRY_BUCKET_NS,
@@ -267,7 +268,12 @@ class AquaApp:
267
268
  logger.info(f"Artifact not found in model {model_id}.")
268
269
  return False
269
270
 
270
- def get_config(self, model_id: str, config_file_name: str) -> Dict:
271
+ def get_config(
272
+ self,
273
+ model_id: str,
274
+ config_file_name: str,
275
+ config_folder: Optional[str] = ConfigFolder.CONFIG,
276
+ ) -> Dict:
271
277
  """Gets the config for the given Aqua model.
272
278
 
273
279
  Parameters
@@ -276,12 +282,17 @@ class AquaApp:
276
282
  The OCID of the Aqua model.
277
283
  config_file_name: str
278
284
  name of the config file
285
+ config_folder: (str, optional):
286
+ subfolder path where config_file_name needs to be searched
287
+ Defaults to `ConfigFolder.CONFIG`.
288
+ When searching inside model artifact directory , the value is ConfigFolder.ARTIFACT`
279
289
 
280
290
  Returns
281
291
  -------
282
292
  Dict:
283
293
  A dict of allowed configs.
284
294
  """
295
+ config_folder = config_folder or ConfigFolder.CONFIG
285
296
  oci_model = self.ds_client.get_model(model_id).data
286
297
  oci_aqua = (
287
298
  (
@@ -296,33 +307,49 @@ class AquaApp:
296
307
  raise AquaRuntimeError(f"Target model {oci_model.id} is not Aqua model.")
297
308
 
298
309
  config = {}
299
- artifact_path = get_artifact_path(oci_model.custom_metadata_list)
310
+ # if the current model has a service model tag, then
311
+ if Tags.AQUA_SERVICE_MODEL_TAG in oci_model.freeform_tags:
312
+ base_model_ocid = oci_model.freeform_tags[Tags.AQUA_SERVICE_MODEL_TAG]
313
+ logger.info(
314
+ f"Base model found for the model: {oci_model.id}. "
315
+ f"Loading {config_file_name} for base model {base_model_ocid}."
316
+ )
317
+ if config_folder == ConfigFolder.ARTIFACT:
318
+ artifact_path = get_artifact_path(oci_model.custom_metadata_list)
319
+ else:
320
+ base_model = self.ds_client.get_model(base_model_ocid).data
321
+ artifact_path = get_artifact_path(base_model.custom_metadata_list)
322
+ else:
323
+ logger.info(f"Loading {config_file_name} for model {oci_model.id}...")
324
+ artifact_path = get_artifact_path(oci_model.custom_metadata_list)
300
325
  if not artifact_path:
301
- logger.error(
326
+ logger.debug(
302
327
  f"Failed to get artifact path from custom metadata for the model: {model_id}"
303
328
  )
304
329
  return config
305
330
 
306
- try:
307
- config_path = f"{os.path.dirname(artifact_path)}/config/"
308
- config = load_config(
309
- config_path,
310
- config_file_name=config_file_name,
311
- )
312
- except Exception:
313
- # todo: temp fix for issue related to config load for byom models, update logic to choose the right path
331
+ config_path = os.path.join(os.path.dirname(artifact_path), config_folder)
332
+ if not is_path_exists(config_path):
333
+ config_path = os.path.join(artifact_path.rstrip("/"), config_folder)
334
+ if not is_path_exists(config_path):
335
+ config_path = f"{artifact_path.rstrip('/')}/"
336
+ config_file_path = os.path.join(config_path, config_file_name)
337
+ if is_path_exists(config_file_path):
314
338
  try:
315
- config_path = f"{artifact_path.rstrip('/')}/config/"
316
339
  config = load_config(
317
340
  config_path,
318
341
  config_file_name=config_file_name,
319
342
  )
320
343
  except Exception:
321
- pass
344
+ logger.debug(
345
+ f"Error loading the {config_file_name} at path {config_path}.\n"
346
+ f"{traceback.format_exc()}"
347
+ )
322
348
 
323
349
  if not config:
324
- logger.error(
325
- f"{config_file_name} is not available for the model: {model_id}. Check if the custom metadata has the artifact path set."
350
+ logger.debug(
351
+ f"{config_file_name} is not available for the model: {model_id}. "
352
+ f"Check if the custom metadata has the artifact path set."
326
353
  )
327
354
  return config
328
355
 
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env python
2
+ # Copyright (c) 2025 Oracle and/or its affiliates.
3
+ # Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/