oracle-ads 2.12.8__py3-none-any.whl → 2.12.10__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 (82) hide show
  1. ads/aqua/__init__.py +4 -3
  2. ads/aqua/app.py +40 -18
  3. ads/aqua/client/__init__.py +3 -0
  4. ads/aqua/client/client.py +799 -0
  5. ads/aqua/common/enums.py +3 -0
  6. ads/aqua/common/utils.py +62 -2
  7. ads/aqua/data.py +2 -19
  8. ads/aqua/evaluation/entities.py +6 -0
  9. ads/aqua/evaluation/evaluation.py +45 -15
  10. ads/aqua/extension/aqua_ws_msg_handler.py +14 -7
  11. ads/aqua/extension/base_handler.py +12 -9
  12. ads/aqua/extension/deployment_handler.py +8 -4
  13. ads/aqua/extension/finetune_handler.py +8 -14
  14. ads/aqua/extension/model_handler.py +30 -6
  15. ads/aqua/extension/ui_handler.py +13 -1
  16. ads/aqua/finetuning/constants.py +5 -2
  17. ads/aqua/finetuning/entities.py +73 -17
  18. ads/aqua/finetuning/finetuning.py +110 -82
  19. ads/aqua/model/entities.py +5 -1
  20. ads/aqua/model/model.py +230 -104
  21. ads/aqua/modeldeployment/deployment.py +35 -11
  22. ads/aqua/modeldeployment/entities.py +7 -4
  23. ads/aqua/ui.py +24 -2
  24. ads/cli.py +16 -8
  25. ads/common/auth.py +9 -9
  26. ads/llm/autogen/__init__.py +2 -0
  27. ads/llm/autogen/constants.py +15 -0
  28. ads/llm/autogen/reports/__init__.py +2 -0
  29. ads/llm/autogen/reports/base.py +67 -0
  30. ads/llm/autogen/reports/data.py +103 -0
  31. ads/llm/autogen/reports/session.py +526 -0
  32. ads/llm/autogen/reports/templates/chat_box.html +13 -0
  33. ads/llm/autogen/reports/templates/chat_box_lt.html +5 -0
  34. ads/llm/autogen/reports/templates/chat_box_rt.html +6 -0
  35. ads/llm/autogen/reports/utils.py +56 -0
  36. ads/llm/autogen/v02/__init__.py +4 -0
  37. ads/llm/autogen/{client_v02.py → v02/client.py} +23 -10
  38. ads/llm/autogen/v02/log_handlers/__init__.py +2 -0
  39. ads/llm/autogen/v02/log_handlers/oci_file_handler.py +83 -0
  40. ads/llm/autogen/v02/loggers/__init__.py +6 -0
  41. ads/llm/autogen/v02/loggers/metric_logger.py +320 -0
  42. ads/llm/autogen/v02/loggers/session_logger.py +580 -0
  43. ads/llm/autogen/v02/loggers/utils.py +86 -0
  44. ads/llm/autogen/v02/runtime_logging.py +163 -0
  45. ads/llm/guardrails/base.py +6 -5
  46. ads/llm/langchain/plugins/chat_models/oci_data_science.py +46 -20
  47. ads/llm/langchain/plugins/llms/oci_data_science_model_deployment_endpoint.py +38 -11
  48. ads/model/__init__.py +11 -13
  49. ads/model/artifact.py +47 -8
  50. ads/model/extractor/embedding_onnx_extractor.py +80 -0
  51. ads/model/framework/embedding_onnx_model.py +438 -0
  52. ads/model/generic_model.py +26 -24
  53. ads/model/model_metadata.py +8 -7
  54. ads/opctl/config/merger.py +13 -14
  55. ads/opctl/operator/common/operator_config.py +4 -4
  56. ads/opctl/operator/lowcode/common/transformations.py +50 -8
  57. ads/opctl/operator/lowcode/common/utils.py +22 -6
  58. ads/opctl/operator/lowcode/forecast/__main__.py +10 -0
  59. ads/opctl/operator/lowcode/forecast/const.py +3 -0
  60. ads/opctl/operator/lowcode/forecast/model/arima.py +19 -13
  61. ads/opctl/operator/lowcode/forecast/model/automlx.py +129 -36
  62. ads/opctl/operator/lowcode/forecast/model/autots.py +1 -0
  63. ads/opctl/operator/lowcode/forecast/model/base_model.py +58 -17
  64. ads/opctl/operator/lowcode/forecast/model/forecast_datasets.py +1 -1
  65. ads/opctl/operator/lowcode/forecast/model/neuralprophet.py +10 -3
  66. ads/opctl/operator/lowcode/forecast/model/prophet.py +25 -18
  67. ads/opctl/operator/lowcode/forecast/model_evaluator.py +3 -2
  68. ads/opctl/operator/lowcode/forecast/operator_config.py +31 -0
  69. ads/opctl/operator/lowcode/forecast/schema.yaml +76 -0
  70. ads/opctl/operator/lowcode/forecast/utils.py +8 -6
  71. ads/opctl/operator/lowcode/forecast/whatifserve/__init__.py +7 -0
  72. ads/opctl/operator/lowcode/forecast/whatifserve/deployment_manager.py +233 -0
  73. ads/opctl/operator/lowcode/forecast/whatifserve/score.py +238 -0
  74. ads/telemetry/base.py +18 -11
  75. ads/telemetry/client.py +33 -13
  76. ads/templates/schemas/openapi.json +1740 -0
  77. ads/templates/score_embedding_onnx.jinja2 +202 -0
  78. {oracle_ads-2.12.8.dist-info → oracle_ads-2.12.10.dist-info}/METADATA +11 -10
  79. {oracle_ads-2.12.8.dist-info → oracle_ads-2.12.10.dist-info}/RECORD +82 -56
  80. {oracle_ads-2.12.8.dist-info → oracle_ads-2.12.10.dist-info}/LICENSE.txt +0 -0
  81. {oracle_ads-2.12.8.dist-info → oracle_ads-2.12.10.dist-info}/WHEEL +0 -0
  82. {oracle_ads-2.12.8.dist-info → oracle_ads-2.12.10.dist-info}/entry_points.txt +0 -0
ads/aqua/__init__.py CHANGED
@@ -1,12 +1,13 @@
1
1
  #!/usr/bin/env python
2
- # -*- coding: utf-8 -*-
3
- # Copyright (c) 2024 Oracle and/or its affiliates.
2
+ # Copyright (c) 2024, 2025 Oracle and/or its affiliates.
4
3
  # Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
5
4
 
6
5
 
7
6
  import os
7
+ from logging import getLogger
8
8
 
9
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
 
@@ -19,6 +20,7 @@ def get_logger_level():
19
20
  return level
20
21
 
21
22
 
23
+ logger = getLogger(__name__)
22
24
  logger.setLevel(get_logger_level())
23
25
 
24
26
 
@@ -27,7 +29,6 @@ def set_log_level(log_level: str):
27
29
 
28
30
  log_level = log_level.upper()
29
31
  logger.setLevel(log_level.upper())
30
- logger.handlers[0].setLevel(log_level)
31
32
 
32
33
 
33
34
  if OCI_RESOURCE_PRINCIPAL_VERSION:
ads/aqua/app.py CHANGED
@@ -1,8 +1,10 @@
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
+ import json
5
6
  import os
7
+ import traceback
6
8
  from dataclasses import fields
7
9
  from typing import Dict, Union
8
10
 
@@ -22,7 +24,7 @@ from ads.aqua.common.utils import (
22
24
  from ads.aqua.constants import UNKNOWN
23
25
  from ads.common import oci_client as oc
24
26
  from ads.common.auth import default_signer
25
- from ads.common.utils import extract_region
27
+ from ads.common.utils import extract_region, is_path_exists
26
28
  from ads.config import (
27
29
  AQUA_TELEMETRY_BUCKET,
28
30
  AQUA_TELEMETRY_BUCKET_NS,
@@ -135,6 +137,8 @@ class AquaApp:
135
137
  description: str = None,
136
138
  compartment_id: str = None,
137
139
  project_id: str = None,
140
+ freeform_tags: dict = None,
141
+ defined_tags: dict = None,
138
142
  **kwargs,
139
143
  ) -> tuple:
140
144
  """Creates ModelVersionSet from given ID or Name.
@@ -153,7 +157,10 @@ class AquaApp:
153
157
  Project OCID.
154
158
  tag: (str, optional)
155
159
  calling tag, can be Tags.AQUA_FINE_TUNING or Tags.AQUA_EVALUATION
156
-
160
+ freeform_tags: (dict, optional)
161
+ Freeform tags for the model version set
162
+ defined_tags: (dict, optional)
163
+ Defined tags for the model version set
157
164
  Returns
158
165
  -------
159
166
  tuple: (model_version_set_id, model_version_set_name)
@@ -182,6 +189,7 @@ class AquaApp:
182
189
  mvs_freeform_tags = {
183
190
  tag: tag,
184
191
  }
192
+ mvs_freeform_tags = {**mvs_freeform_tags, **(freeform_tags or {})}
185
193
  model_version_set = (
186
194
  ModelVersionSet()
187
195
  .with_compartment_id(compartment_id)
@@ -189,6 +197,7 @@ class AquaApp:
189
197
  .with_name(model_version_set_name)
190
198
  .with_description(description)
191
199
  .with_freeform_tags(**mvs_freeform_tags)
200
+ .with_defined_tags(**(defined_tags or {}))
192
201
  # TODO: decide what parameters will be needed
193
202
  # when refactor eval to use this method, we need to pass tag here.
194
203
  .create(**kwargs)
@@ -288,33 +297,44 @@ class AquaApp:
288
297
  raise AquaRuntimeError(f"Target model {oci_model.id} is not Aqua model.")
289
298
 
290
299
  config = {}
291
- artifact_path = get_artifact_path(oci_model.custom_metadata_list)
300
+ # if the current model has a service model tag, then
301
+ if Tags.AQUA_SERVICE_MODEL_TAG in oci_model.freeform_tags:
302
+ base_model_ocid = oci_model.freeform_tags[Tags.AQUA_SERVICE_MODEL_TAG]
303
+ logger.info(
304
+ f"Base model found for the model: {oci_model.id}. "
305
+ f"Loading {config_file_name} for base model {base_model_ocid}."
306
+ )
307
+ base_model = self.ds_client.get_model(base_model_ocid).data
308
+ artifact_path = get_artifact_path(base_model.custom_metadata_list)
309
+ config_path = f"{os.path.dirname(artifact_path)}/config/"
310
+ else:
311
+ logger.info(f"Loading {config_file_name} for model {oci_model.id}...")
312
+ artifact_path = get_artifact_path(oci_model.custom_metadata_list)
313
+ config_path = f"{artifact_path.rstrip('/')}/config/"
314
+
292
315
  if not artifact_path:
293
- logger.error(
316
+ logger.debug(
294
317
  f"Failed to get artifact path from custom metadata for the model: {model_id}"
295
318
  )
296
319
  return config
297
320
 
298
- try:
299
- config_path = f"{os.path.dirname(artifact_path)}/config/"
300
- config = load_config(
301
- config_path,
302
- config_file_name=config_file_name,
303
- )
304
- except Exception:
305
- # todo: temp fix for issue related to config load for byom models, update logic to choose the right path
321
+ config_file_path = f"{config_path}{config_file_name}"
322
+ if is_path_exists(config_file_path):
306
323
  try:
307
- config_path = f"{artifact_path.rstrip('/')}/config/"
308
324
  config = load_config(
309
325
  config_path,
310
326
  config_file_name=config_file_name,
311
327
  )
312
328
  except Exception:
313
- pass
329
+ logger.debug(
330
+ f"Error loading the {config_file_name} at path {config_path}.\n"
331
+ f"{traceback.format_exc()}"
332
+ )
314
333
 
315
334
  if not config:
316
- logger.error(
317
- f"{config_file_name} is not available for the model: {model_id}. Check if the custom metadata has the artifact path set."
335
+ logger.debug(
336
+ f"{config_file_name} is not available for the model: {model_id}. "
337
+ f"Check if the custom metadata has the artifact path set."
318
338
  )
319
339
  return config
320
340
 
@@ -340,7 +360,9 @@ class CLIBuilderMixin:
340
360
  """
341
361
  cmd = f"ads aqua {self._command}"
342
362
  params = [
343
- f"--{field.name} {getattr(self,field.name)}"
363
+ f"--{field.name} {json.dumps(getattr(self, field.name))}"
364
+ if isinstance(getattr(self, field.name), dict)
365
+ else f"--{field.name} {getattr(self, field.name)}"
344
366
  for field in fields(self.__class__)
345
367
  if getattr(self, field.name) is not None
346
368
  ]
@@ -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/