oracle-ads 2.12.1__py3-none-any.whl → 2.12.3__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 (43) hide show
  1. ads/aqua/common/enums.py +9 -0
  2. ads/aqua/common/utils.py +83 -6
  3. ads/aqua/config/config.py +0 -15
  4. ads/aqua/constants.py +2 -0
  5. ads/aqua/extension/deployment_handler.py +2 -0
  6. ads/aqua/extension/finetune_handler.py +1 -2
  7. ads/aqua/extension/ui_handler.py +22 -3
  8. ads/aqua/finetuning/entities.py +5 -4
  9. ads/aqua/finetuning/finetuning.py +13 -8
  10. ads/aqua/model/constants.py +1 -0
  11. ads/aqua/model/entities.py +2 -0
  12. ads/aqua/model/model.py +223 -138
  13. ads/aqua/modeldeployment/deployment.py +106 -62
  14. ads/aqua/modeldeployment/entities.py +10 -2
  15. ads/aqua/ui.py +29 -16
  16. ads/config.py +3 -8
  17. ads/llm/deploy.py +6 -0
  18. ads/llm/guardrails/base.py +0 -1
  19. ads/llm/langchain/plugins/chat_models/oci_data_science.py +118 -41
  20. ads/llm/langchain/plugins/llms/oci_data_science_model_deployment_endpoint.py +18 -14
  21. ads/llm/templates/score_chain.jinja2 +0 -1
  22. ads/model/datascience_model.py +519 -16
  23. ads/model/deployment/model_deployment.py +13 -0
  24. ads/model/deployment/model_deployment_infrastructure.py +34 -0
  25. ads/model/generic_model.py +10 -0
  26. ads/model/model_properties.py +1 -0
  27. ads/model/service/oci_datascience_model.py +28 -0
  28. ads/opctl/operator/common/data/synthetic.csv +16001 -0
  29. ads/opctl/operator/lowcode/anomaly/MLoperator +1 -0
  30. ads/opctl/operator/lowcode/anomaly/const.py +66 -1
  31. ads/opctl/operator/lowcode/anomaly/model/anomaly_merlion.py +161 -0
  32. ads/opctl/operator/lowcode/anomaly/model/autots.py +30 -15
  33. ads/opctl/operator/lowcode/anomaly/model/factory.py +15 -3
  34. ads/opctl/operator/lowcode/anomaly/model/randomcutforest.py +1 -1
  35. ads/opctl/operator/lowcode/anomaly/schema.yaml +10 -0
  36. ads/opctl/operator/lowcode/anomaly/utils.py +3 -0
  37. {oracle_ads-2.12.1.dist-info → oracle_ads-2.12.3.dist-info}/METADATA +2 -1
  38. {oracle_ads-2.12.1.dist-info → oracle_ads-2.12.3.dist-info}/RECORD +41 -41
  39. ads/aqua/config/deployment_config_defaults.json +0 -37
  40. ads/aqua/config/resource_limit_names.json +0 -8
  41. {oracle_ads-2.12.1.dist-info → oracle_ads-2.12.3.dist-info}/LICENSE.txt +0 -0
  42. {oracle_ads-2.12.1.dist-info → oracle_ads-2.12.3.dist-info}/WHEEL +0 -0
  43. {oracle_ads-2.12.1.dist-info → oracle_ads-2.12.3.dist-info}/entry_points.txt +0 -0
@@ -57,6 +57,8 @@ class ModelDeploymentInfrastructure(Builder):
57
57
  The web concurrency of model deployment
58
58
  subnet_id: str
59
59
  The subnet id of model deployment
60
+ private_endpoint_id: str
61
+ The private endpoint id of model deployment
60
62
 
61
63
  Methods
62
64
  -------
@@ -84,6 +86,8 @@ class ModelDeploymentInfrastructure(Builder):
84
86
  Sets the web concurrency of model deployment
85
87
  with_subnet_id(subnet_id)
86
88
  Sets the subnet id of model deployment
89
+ with_private_endpoint_id(private_endpoint)
90
+ Sets the private endpoint id of model deployment
87
91
 
88
92
  Example
89
93
  -------
@@ -100,6 +104,7 @@ class ModelDeploymentInfrastructure(Builder):
100
104
  ... .with_bandwidth_mbps(10)
101
105
  ... .with_web_concurrency(10)
102
106
  ... .with_subnet_id(<subnet_id>)
107
+ ... .with_private_endpoint_id(<private_endpoint_id>)
103
108
  ... .with_access_log(
104
109
  ... log_group_id=<log_group_id>,
105
110
  ... log_id=<log_id>
@@ -143,6 +148,7 @@ class ModelDeploymentInfrastructure(Builder):
143
148
  CONST_WEB_CONCURRENCY = "webConcurrency"
144
149
  CONST_STREAM_CONFIG_DETAILS = "streamConfigurationDetails"
145
150
  CONST_SUBNET_ID = "subnetId"
151
+ CONST_PRIVATE_ENDPOINT_ID = "privateEndpointId"
146
152
 
147
153
  attribute_map = {
148
154
  CONST_PROJECT_ID: "project_id",
@@ -159,6 +165,7 @@ class ModelDeploymentInfrastructure(Builder):
159
165
  CONST_LOG_GROUP_ID: "log_group_id",
160
166
  CONST_WEB_CONCURRENCY: "web_concurrency",
161
167
  CONST_SUBNET_ID: "subnet_id",
168
+ CONST_PRIVATE_ENDPOINT_ID: "private_endpoint_id",
162
169
  }
163
170
 
164
171
  shape_config_details_attribute_map = {
@@ -186,6 +193,7 @@ class ModelDeploymentInfrastructure(Builder):
186
193
  CONST_SHAPE_NAME: f"{MODEL_CONFIG_DETAILS_PATH}.instance_configuration.instance_shape_name",
187
194
  CONST_SHAPE_CONFIG_DETAILS: f"{MODEL_CONFIG_DETAILS_PATH}.instance_configuration.model_deployment_instance_shape_config_details",
188
195
  CONST_SUBNET_ID: f"{MODEL_CONFIG_DETAILS_PATH}.instance_configuration.subnet_id",
196
+ CONST_PRIVATE_ENDPOINT_ID: f"{MODEL_CONFIG_DETAILS_PATH}.instance_configuration.private_endpoint_id",
189
197
  CONST_REPLICA: f"{MODEL_CONFIG_DETAILS_PATH}.scaling_policy.instance_count",
190
198
  CONST_BANDWIDTH_MBPS: f"{MODEL_CONFIG_DETAILS_PATH}.bandwidth_mbps",
191
199
  CONST_ACCESS_LOG: "category_log_details.access",
@@ -613,6 +621,32 @@ class ModelDeploymentInfrastructure(Builder):
613
621
  """
614
622
  return self.get_spec(self.CONST_SUBNET_ID, None)
615
623
 
624
+ def with_private_endpoint_id(self, private_endpoint_id: str) -> "ModelDeploymentInfrastructure":
625
+ """Sets the private endpoint id of model deployment.
626
+
627
+ Parameters
628
+ ----------
629
+ private_endpoint_id : str
630
+ The private endpoint id of model deployment.
631
+
632
+ Returns
633
+ -------
634
+ ModelDeploymentInfrastructure
635
+ The ModelDeploymentInfrastructure instance (self).
636
+ """
637
+ return self.set_spec(self.CONST_PRIVATE_ENDPOINT_ID, private_endpoint_id)
638
+
639
+ @property
640
+ def private_endpoint_id(self) -> str:
641
+ """The model deployment private endpoint id.
642
+
643
+ Returns
644
+ -------
645
+ str
646
+ The model deployment private endpoint id.
647
+ """
648
+ return self.get_spec(self.CONST_PRIVATE_ENDPOINT_ID, None)
649
+
616
650
  def init(self, **kwargs) -> "ModelDeploymentInfrastructure":
617
651
  """Initializes a starter specification for the ModelDeploymentInfrastructure.
618
652
 
@@ -2262,6 +2262,7 @@ class GenericModel(MetadataMixin, Introspectable, EvaluatorMixin):
2262
2262
  description: Optional[str] = None,
2263
2263
  deployment_instance_shape: Optional[str] = None,
2264
2264
  deployment_instance_subnet_id: Optional[str] = None,
2265
+ deployment_instance_private_endpoint_id: Optional[str] = None,
2265
2266
  deployment_instance_count: Optional[int] = None,
2266
2267
  deployment_bandwidth_mbps: Optional[int] = None,
2267
2268
  deployment_log_group_id: Optional[str] = None,
@@ -2312,6 +2313,8 @@ class GenericModel(MetadataMixin, Introspectable, EvaluatorMixin):
2312
2313
  The shape of the instance used for deployment.
2313
2314
  deployment_instance_subnet_id: (str, optional). Default to None.
2314
2315
  The subnet id of the instance used for deployment.
2316
+ deployment_instance_private_endpoint_id: (str, optional). Default to None.
2317
+ The private endpoint id of instance used for deployment.
2315
2318
  deployment_instance_count: (int, optional). Defaults to 1.
2316
2319
  The number of instance used for deployment.
2317
2320
  deployment_bandwidth_mbps: (int, optional). Defaults to 10.
@@ -2432,6 +2435,8 @@ class GenericModel(MetadataMixin, Introspectable, EvaluatorMixin):
2432
2435
  or self.properties.deployment_image,
2433
2436
  deployment_instance_subnet_id=existing_infrastructure.subnet_id
2434
2437
  or self.properties.deployment_instance_subnet_id,
2438
+ deployment_instance_private_endpoint_id=existing_infrastructure.private_endpoint_id
2439
+ or self.properties.deployment_instance_private_endpoint_id,
2435
2440
  ).to_dict()
2436
2441
 
2437
2442
  property_dict.update(override_properties)
@@ -2465,6 +2470,7 @@ class GenericModel(MetadataMixin, Introspectable, EvaluatorMixin):
2465
2470
  .with_shape_name(self.properties.deployment_instance_shape)
2466
2471
  .with_replica(self.properties.deployment_instance_count)
2467
2472
  .with_subnet_id(self.properties.deployment_instance_subnet_id)
2473
+ .with_private_endpoint_id(self.properties.deployment_instance_private_endpoint_id)
2468
2474
  )
2469
2475
 
2470
2476
  web_concurrency = (
@@ -2611,6 +2617,7 @@ class GenericModel(MetadataMixin, Introspectable, EvaluatorMixin):
2611
2617
  deployment_description: Optional[str] = None,
2612
2618
  deployment_instance_shape: Optional[str] = None,
2613
2619
  deployment_instance_subnet_id: Optional[str] = None,
2620
+ deployment_instance_private_endpoint_id: Optional[str] = None,
2614
2621
  deployment_instance_count: Optional[int] = None,
2615
2622
  deployment_bandwidth_mbps: Optional[int] = None,
2616
2623
  deployment_log_group_id: Optional[str] = None,
@@ -2701,6 +2708,8 @@ class GenericModel(MetadataMixin, Introspectable, EvaluatorMixin):
2701
2708
  The shape of the instance used for deployment.
2702
2709
  deployment_instance_subnet_id: (str, optional). Default to None.
2703
2710
  The subnet id of the instance used for deployment.
2711
+ deployment_instance_private_endpoint_id: (str, optional). Default to None.
2712
+ The private endpoint id of instance used for deployment.
2704
2713
  deployment_instance_count: (int, optional). Defaults to 1.
2705
2714
  The number of instance used for deployment.
2706
2715
  deployment_bandwidth_mbps: (int, optional). Defaults to 10.
@@ -2846,6 +2855,7 @@ class GenericModel(MetadataMixin, Introspectable, EvaluatorMixin):
2846
2855
  description=deployment_description,
2847
2856
  deployment_instance_shape=self.properties.deployment_instance_shape,
2848
2857
  deployment_instance_subnet_id=self.properties.deployment_instance_subnet_id,
2858
+ deployment_instance_private_endpoint_id=self.properties.deployment_instance_private_endpoint_id,
2849
2859
  deployment_instance_count=self.properties.deployment_instance_count,
2850
2860
  deployment_bandwidth_mbps=self.properties.deployment_bandwidth_mbps,
2851
2861
  deployment_log_group_id=self.properties.deployment_log_group_id,
@@ -29,6 +29,7 @@ class ModelProperties(BaseProperties):
29
29
  overwrite_existing_artifact: bool = None
30
30
  deployment_instance_shape: str = None
31
31
  deployment_instance_subnet_id: str = None
32
+ deployment_instance_private_endpoint_id: str = None
32
33
  deployment_instance_count: int = None
33
34
  deployment_bandwidth_mbps: int = None
34
35
  deployment_log_group_id: str = None
@@ -278,6 +278,34 @@ class OCIDataScienceModel(
278
278
  raise ModelArtifactNotFoundError()
279
279
  return {}
280
280
 
281
+ @check_for_model_id(
282
+ msg="Model needs to be restored before the archived artifact content can be accessed."
283
+ )
284
+ def restore_archived_model_artifact(
285
+ self, restore_model_for_hours_specified: Optional[int] = None
286
+ ) -> None:
287
+ """Restores the archived model artifact.
288
+
289
+ Parameters
290
+ ----------
291
+ model_id : str
292
+ The unique identifier of the model to restore.
293
+ restore_model_for_hours_specified : Optional[int]
294
+ The duration (in hours) for which the model should be restored.
295
+
296
+ Returns
297
+ -------
298
+ None
299
+
300
+ Raises
301
+ ------
302
+ ModelArtifactNotFoundError
303
+ If model artifact not found.
304
+ """
305
+ return self.client.restore_archived_model_artifact(
306
+ model_id=self.id,
307
+ restore_model_for_hours_specified=restore_model_for_hours_specified).headers["opc-work-request-id"]
308
+
281
309
  @check_for_model_id(
282
310
  msg="Model needs to be saved to the Model Catalog before the artifact content can be read."
283
311
  )