oracle-ads 2.11.19__py3-none-any.whl → 2.12.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 (32) hide show
  1. ads/aqua/config/evaluation/evaluation_service_config.py +1 -0
  2. ads/aqua/extension/model_handler.py +17 -21
  3. ads/aqua/model/constants.py +3 -1
  4. ads/llm/__init__.py +10 -4
  5. ads/llm/chat_template.py +31 -0
  6. ads/llm/guardrails/base.py +3 -2
  7. ads/llm/guardrails/huggingface.py +1 -1
  8. ads/llm/langchain/plugins/chat_models/__init__.py +5 -0
  9. ads/llm/langchain/plugins/chat_models/oci_data_science.py +924 -0
  10. ads/llm/langchain/plugins/llms/__init__.py +5 -0
  11. ads/llm/langchain/plugins/llms/oci_data_science_model_deployment_endpoint.py +939 -0
  12. ads/llm/requirements.txt +2 -2
  13. ads/llm/serialize.py +3 -6
  14. ads/llm/templates/tool_chat_template_hermes.jinja +130 -0
  15. ads/llm/templates/tool_chat_template_mistral_parallel.jinja +94 -0
  16. ads/opctl/operator/lowcode/anomaly/const.py +7 -2
  17. ads/opctl/operator/lowcode/anomaly/model/autots.py +30 -35
  18. ads/opctl/operator/lowcode/anomaly/model/factory.py +9 -8
  19. ads/opctl/operator/lowcode/anomaly/schema.yaml +8 -2
  20. ads/opctl/operator/lowcode/forecast/MLoperator +3 -3
  21. ads/opctl/operator/lowcode/forecast/model/automlx.py +1 -1
  22. ads/opctl/operator/lowcode/forecast/model/forecast_datasets.py +1 -1
  23. {oracle_ads-2.11.19.dist-info → oracle_ads-2.12.1.dist-info}/METADATA +6 -4
  24. {oracle_ads-2.11.19.dist-info → oracle_ads-2.12.1.dist-info}/RECORD +27 -25
  25. ads/llm/langchain/plugins/base.py +0 -118
  26. ads/llm/langchain/plugins/contant.py +0 -44
  27. ads/llm/langchain/plugins/embeddings.py +0 -64
  28. ads/llm/langchain/plugins/llm_gen_ai.py +0 -301
  29. ads/llm/langchain/plugins/llm_md.py +0 -316
  30. {oracle_ads-2.11.19.dist-info → oracle_ads-2.12.1.dist-info}/LICENSE.txt +0 -0
  31. {oracle_ads-2.11.19.dist-info → oracle_ads-2.12.1.dist-info}/WHEEL +0 -0
  32. {oracle_ads-2.11.19.dist-info → oracle_ads-2.12.1.dist-info}/entry_points.txt +0 -0
@@ -224,6 +224,7 @@ class UIConfig(Serializable):
224
224
 
225
225
  class Config:
226
226
  extra = "ignore"
227
+ protected_namespaces = ()
227
228
 
228
229
 
229
230
  class EvaluationServiceConfig(Serializable):
@@ -13,7 +13,6 @@ from ads.aqua.common.utils import get_hf_model_info, list_hf_models
13
13
  from ads.aqua.extension.base_handler import AquaAPIhandler
14
14
  from ads.aqua.extension.errors import Errors
15
15
  from ads.aqua.model import AquaModelApp
16
- from ads.aqua.model.constants import ModelTask
17
16
  from ads.aqua.model.entities import AquaModelSummary, HFModelSummary
18
17
  from ads.aqua.ui import ModelFormat
19
18
 
@@ -68,7 +67,7 @@ class AquaModelHandler(AquaAPIhandler):
68
67
  return self.finish(AquaModelApp().get(model_id))
69
68
 
70
69
  @handle_exceptions
71
- def delete(self):
70
+ def delete(self, id=""):
72
71
  """Handles DELETE request for clearing cache"""
73
72
  url_parse = urlparse(self.request.path)
74
73
  paths = url_parse.path.strip("/")
@@ -177,10 +176,8 @@ class AquaHuggingFaceHandler(AquaAPIhandler):
177
176
 
178
177
  return None
179
178
 
180
-
181
-
182
179
  @handle_exceptions
183
- def get(self,*args, **kwargs):
180
+ def get(self, *args, **kwargs):
184
181
  """
185
182
  Finds a list of matching models from hugging face based on query string provided from users.
186
183
 
@@ -194,13 +191,11 @@ class AquaHuggingFaceHandler(AquaAPIhandler):
194
191
  Returns the matching model ids string
195
192
  """
196
193
 
197
- query=self.get_argument("query",default=None)
194
+ query = self.get_argument("query", default=None)
198
195
  if not query:
199
- raise HTTPError(400,Errors.MISSING_REQUIRED_PARAMETER.format("query"))
200
- models=list_hf_models(query)
201
- return self.finish({"models":models})
202
-
203
-
196
+ raise HTTPError(400, Errors.MISSING_REQUIRED_PARAMETER.format("query"))
197
+ models = list_hf_models(query)
198
+ return self.finish({"models": models})
204
199
 
205
200
  @handle_exceptions
206
201
  def post(self, *args, **kwargs):
@@ -234,16 +229,17 @@ class AquaHuggingFaceHandler(AquaAPIhandler):
234
229
  "Please verify the model's status on the Hugging Face Model Hub or select a different model."
235
230
  )
236
231
 
237
- # Check pipeline_tag, it should be `text-generation`
238
- if (
239
- not hf_model_info.pipeline_tag
240
- or hf_model_info.pipeline_tag.lower() != ModelTask.TEXT_GENERATION
241
- ):
242
- raise AquaRuntimeError(
243
- f"Unsupported pipeline tag for the chosen model: '{hf_model_info.pipeline_tag}'. "
244
- f"AQUA currently supports the following tasks only: {', '.join(ModelTask.values())}. "
245
- "Please select a model with a compatible pipeline tag."
246
- )
232
+ # Commented the validation below to let users to register any model type.
233
+ # # Check pipeline_tag, it should be `text-generation`
234
+ # if not (
235
+ # hf_model_info.pipeline_tag
236
+ # and hf_model_info.pipeline_tag.lower() in ModelTask
237
+ # ):
238
+ # raise AquaRuntimeError(
239
+ # f"Unsupported pipeline tag for the chosen model: '{hf_model_info.pipeline_tag}'. "
240
+ # f"AQUA currently supports the following tasks only: {', '.join(ModelTask.values())}. "
241
+ # "Please select a model with a compatible pipeline tag."
242
+ # )
247
243
 
248
244
  # Check if it is a service/verified model
249
245
  aqua_model_info: AquaModelSummary = self._find_matching_aqua_model(
@@ -1,5 +1,4 @@
1
1
  #!/usr/bin/env python
2
- # -*- coding: utf-8 -*-
3
2
  # Copyright (c) 2024 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
 
@@ -9,6 +8,7 @@ aqua.model.constants
9
8
 
10
9
  This module contains constants/enums used in Aqua Model.
11
10
  """
11
+
12
12
  from ads.common.extended_enum import ExtendedEnumMeta
13
13
 
14
14
 
@@ -21,6 +21,8 @@ class ModelCustomMetadataFields(str, metaclass=ExtendedEnumMeta):
21
21
 
22
22
  class ModelTask(str, metaclass=ExtendedEnumMeta):
23
23
  TEXT_GENERATION = "text-generation"
24
+ IMAGE_TEXT_TO_TEXT = "image-text-to-text"
25
+ IMAGE_TO_TEXT = "image-to-text"
24
26
 
25
27
 
26
28
  class FineTuningMetricCategories(str, metaclass=ExtendedEnumMeta):
ads/llm/__init__.py CHANGED
@@ -6,10 +6,16 @@
6
6
 
7
7
  try:
8
8
  import langchain
9
- from ads.llm.langchain.plugins.llm_gen_ai import GenerativeAI
10
- from ads.llm.langchain.plugins.llm_md import ModelDeploymentTGI
11
- from ads.llm.langchain.plugins.llm_md import ModelDeploymentVLLM
12
- from ads.llm.langchain.plugins.embeddings import GenerativeAIEmbeddings
9
+ from ads.llm.langchain.plugins.llms.oci_data_science_model_deployment_endpoint import (
10
+ OCIModelDeploymentVLLM,
11
+ OCIModelDeploymentTGI,
12
+ )
13
+ from ads.llm.langchain.plugins.chat_models.oci_data_science import (
14
+ ChatOCIModelDeployment,
15
+ ChatOCIModelDeploymentVLLM,
16
+ ChatOCIModelDeploymentTGI,
17
+ )
18
+ from ads.llm.chat_template import ChatTemplates
13
19
  except ImportError as ex:
14
20
  if ex.name == "langchain":
15
21
  raise ImportError(
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*--
3
+
4
+ # Copyright (c) 2023 Oracle and/or its affiliates.
5
+ # Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
6
+
7
+
8
+ import os
9
+
10
+
11
+ class ChatTemplates:
12
+ """Contains chat templates."""
13
+
14
+ @staticmethod
15
+ def _read_template(filename):
16
+ with open(
17
+ os.path.join(os.path.dirname(__file__), "templates", filename),
18
+ mode="r",
19
+ encoding="utf-8",
20
+ ) as f:
21
+ return f.read()
22
+
23
+ @staticmethod
24
+ def mistral():
25
+ """Chat template for auto tool calling with Mistral model deploy with vLLM."""
26
+ return ChatTemplates._read_template("tool_chat_template_mistral_parallel.jinja")
27
+
28
+ @staticmethod
29
+ def hermes():
30
+ """Chat template for auto tool calling with Hermes model deploy with vLLM."""
31
+ return ChatTemplates._read_template("tool_chat_template_hermes.jinja")
@@ -14,7 +14,7 @@ import sys
14
14
  from typing import Any, List, Dict, Tuple
15
15
  from langchain.schema.prompt import PromptValue
16
16
  from langchain.tools.base import BaseTool, ToolException
17
- from langchain.pydantic_v1 import BaseModel, root_validator
17
+ from pydantic import BaseModel, model_validator
18
18
 
19
19
 
20
20
  class RunInfo(BaseModel):
@@ -190,7 +190,8 @@ class Guardrail(BaseTool):
190
190
  This is used by the ``apply_filter()`` method.
191
191
  """
192
192
 
193
- @root_validator
193
+ @model_validator(mode="before")
194
+ @classmethod
194
195
  def default_name(cls, values):
195
196
  """Sets the default name of the guardrail."""
196
197
  if not values.get("name"):
@@ -6,7 +6,7 @@
6
6
 
7
7
 
8
8
  import evaluate
9
- from langchain.pydantic_v1 import root_validator
9
+ from pydantic.v1 import root_validator
10
10
  from .base import Guardrail
11
11
 
12
12
 
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*--
3
+
4
+ # Copyright (c) 2023 Oracle and/or its affiliates.
5
+ # Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/