about summary refs log tree commit diff
path: root/.venv/lib/python3.12/site-packages/azure/ai/ml/entities/_autogen_entities/models
diff options
context:
space:
mode:
Diffstat (limited to '.venv/lib/python3.12/site-packages/azure/ai/ml/entities/_autogen_entities/models')
-rw-r--r--.venv/lib/python3.12/site-packages/azure/ai/ml/entities/_autogen_entities/models/__init__.py18
-rw-r--r--.venv/lib/python3.12/site-packages/azure/ai/ml/entities/_autogen_entities/models/_models.py214
-rw-r--r--.venv/lib/python3.12/site-packages/azure/ai/ml/entities/_autogen_entities/models/_patch.py223
3 files changed, 455 insertions, 0 deletions
diff --git a/.venv/lib/python3.12/site-packages/azure/ai/ml/entities/_autogen_entities/models/__init__.py b/.venv/lib/python3.12/site-packages/azure/ai/ml/entities/_autogen_entities/models/__init__.py
new file mode 100644
index 00000000..cda7689a
--- /dev/null
+++ b/.venv/lib/python3.12/site-packages/azure/ai/ml/entities/_autogen_entities/models/__init__.py
@@ -0,0 +1,18 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) Python Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from ._models import AzureOpenAIDeployment
+from ._models import ServerlessEndpoint
+from ._models import MarketplaceSubscription
+from ._patch import __all__ as _patch_all
+from ._patch import *  # pylint: disable=unused-wildcard-import
+from ._patch import patch_sdk as _patch_sdk
+
+__all__ = ["AzureOpenAIDeployment", "ServerlessEndpoint", "MarketplaceSubscription"]
+__all__.extend([p for p in _patch_all if p not in __all__])
+_patch_sdk()
diff --git a/.venv/lib/python3.12/site-packages/azure/ai/ml/entities/_autogen_entities/models/_models.py b/.venv/lib/python3.12/site-packages/azure/ai/ml/entities/_autogen_entities/models/_models.py
new file mode 100644
index 00000000..3b12203d
--- /dev/null
+++ b/.venv/lib/python3.12/site-packages/azure/ai/ml/entities/_autogen_entities/models/_models.py
@@ -0,0 +1,214 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) Python Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from typing import Any, Dict, Mapping, Optional, TYPE_CHECKING, overload
+
+from .. import _model_base
+from .._model_base import rest_field
+
+if TYPE_CHECKING:
+    from .. import models as _models
+
+
+class AzureOpenAIDeployment(_model_base.Model):
+    """Azure OpenAI Deployment Information.
+
+    Readonly variables are only populated by the server, and will be ignored when sending a request.
+
+    :ivar name: The deployment name.
+    :vartype name: str
+    :ivar model_name: The name of the model to deploy.
+    :vartype model_name: str
+    :ivar model_version: The model version to deploy.
+    :vartype model_version: str
+    :ivar connection_name: The name of the connection to deploy to.
+    :vartype connection_name: str
+    :ivar target_url: The target URL of the AOAI resource for the deployment.
+    :vartype target_url: str
+    :ivar id: The ARM resource id of the deployment.
+    :vartype id: str
+    :ivar properties: Properties of the deployment.
+    :vartype properties: dict[str, str]
+    :ivar tags: Tags of the deployment.
+    :vartype tags: dict[str, str]
+    """
+
+    name: Optional[str] = rest_field(visibility=["read"])
+    """The deployment name."""
+    model_name: Optional[str] = rest_field(visibility=["read"])
+    """The name of the model to deploy."""
+    model_version: Optional[str] = rest_field(visibility=["read"])
+    """The model version to deploy."""
+    connection_name: Optional[str] = rest_field(visibility=["read"])
+    """The name of the connection to deploy to."""
+    target_url: Optional[str] = rest_field(visibility=["read"])
+    """The target URL of the AOAI resource for the deployment."""
+    id: Optional[str] = rest_field(visibility=["read"])
+    """The ARM resource id of the deployment."""
+
+
+class MarketplacePlan(_model_base.Model):
+    """Marketplace Subscription Definition.
+
+    Readonly variables are only populated by the server, and will be ignored when sending a request.
+
+    :ivar publisher_id: The id of the publisher.
+    :vartype publisher_id: str
+    :ivar offer_id: The id of the offering associated with the plan.
+    :vartype offer_id: str
+    :ivar plan_id: The id of the plan.
+    :vartype plan_id: str
+    :ivar term_id: The term id.
+    :vartype term_id: str
+    """
+
+    publisher_id: Optional[str] = rest_field(visibility=["read"])
+    """The id of the publisher."""
+    offer_id: Optional[str] = rest_field(visibility=["read"])
+    """The id of the offering associated with the plan."""
+    plan_id: Optional[str] = rest_field(visibility=["read"])
+    """The id of the plan."""
+    term_id: Optional[str] = rest_field(visibility=["read"])
+    """The term id."""
+
+
+class MarketplaceSubscription(_model_base.Model):
+    """Marketplace Subscription Definition.
+
+    Readonly variables are only populated by the server, and will be ignored when sending a request.
+
+    All required parameters must be populated in order to send to server.
+
+    :ivar name: The marketplace subscription name. Required.
+    :vartype name: str
+    :ivar model_id: Model id for which to create marketplace subscription. Required.
+    :vartype model_id: str
+    :ivar marketplace_plan: The plan associated with the marketplace subscription.
+    :vartype marketplace_plan: ~azure.ai.ml.entities.models.MarketplacePlan
+    :ivar status: Status of the marketplace subscription. Possible values are:
+     "pending_fulfillment_start", "subscribed", "unsubscribed", "suspended".
+    :vartype status: str
+    :ivar provisioning_state: Provisioning state of the marketplace subscription. Possible values
+     are: "creating", "deleting", "succeeded", "failed", "updating", and "canceled".
+    :vartype provisioning_state: str
+    :ivar id: ARM resource id of the marketplace subscription.
+    :vartype id: str
+    """
+
+    name: str = rest_field()
+    """The marketplace subscription name. Required."""
+    model_id: str = rest_field()
+    """Model id for which to create marketplace subscription. Required."""
+    marketplace_plan: Optional["_models.MarketplacePlan"] = rest_field(visibility=["read"])
+    """The plan associated with the marketplace subscription."""
+    status: Optional[str] = rest_field(visibility=["read"])
+    """Status of the marketplace subscription. Possible values are: \"pending_fulfillment_start\",
+     \"subscribed\", \"unsubscribed\", \"suspended\"."""
+    provisioning_state: Optional[str] = rest_field(visibility=["read"])
+    """Provisioning state of the marketplace subscription. Possible values are: \"creating\",
+     \"deleting\", \"succeeded\", \"failed\", \"updating\", and \"canceled\"."""
+    id: Optional[str] = rest_field(visibility=["read"])
+    """ARM resource id of the marketplace subscription."""
+
+    @overload
+    def __init__(
+        self,
+        *,
+        name: str,
+        model_id: str,
+    ): ...
+
+    @overload
+    def __init__(self, mapping: Mapping[str, Any]):
+        """
+        :param mapping: raw JSON to initialize the model.
+        :type mapping: Mapping[str, Any]
+        """
+
+    def __init__(self, *args: Any, **kwargs: Any) -> None:  # pylint: disable=useless-super-delegation
+        super().__init__(*args, **kwargs)
+
+
+class ServerlessEndpoint(_model_base.Model):
+    """Serverless Endpoint Definition.
+
+    Readonly variables are only populated by the server, and will be ignored when sending a request.
+
+    All required parameters must be populated in order to send to server.
+
+    :ivar name: The deployment name. Required.
+    :vartype name: str
+    :ivar auth_mode: Authentication mode of the endpoint.
+    :vartype auth_mode: str
+    :ivar model_id: The id of the model to deploy. Required.
+    :vartype model_id: str
+    :ivar location: Location in which to create endpoint.
+    :vartype location: str
+    :ivar provisioning_state: Provisioning state of the endpoint. Possible values are: "creating",
+     "deleting", "succeeded", "failed", "updating", and "canceled".
+    :vartype provisioning_state: str
+    :ivar tags: Tags for the endpoint.
+    :vartype tags: dict[str, str]
+    :ivar properties: Properties of the endpoint.
+    :vartype properties: dict[str, str]
+    :ivar description: Descripton of the endpoint.
+    :vartype description: str
+    :ivar scoring_uri: Scoring uri of the endpoint.
+    :vartype scoring_uri: str
+    :ivar id: ARM resource id of the endpoint.
+    :vartype id: str
+    :ivar headers: Headers required to hit the endpoint.
+    :vartype id: dict[str, str]
+    """
+
+    name: str = rest_field()
+    """The deployment name. Required."""
+    auth_mode: Optional[str] = rest_field()
+    """Authentication mode of the endpoint. Possible values are: \"key\", \"aad\".
+    Defaults to \"key\" if not given."""
+    model_id: str = rest_field()
+    """The id of the model to deploy. Required."""
+    location: Optional[str] = rest_field(visibility=["read"])
+    """Location in which to create endpoint."""
+    provisioning_state: Optional[str] = rest_field(visibility=["read"])
+    """Provisioning state of the endpoint. Possible values are: \"creating\", \"deleting\",
+     \"succeeded\", \"failed\", \"updating\", and \"canceled\"."""
+    tags: Optional[Dict[str, str]] = rest_field()
+    """Tags for the endpoint."""
+    properties: Optional[Dict[str, str]] = rest_field()
+    """Properties of the endpoint."""
+    description: Optional[str] = rest_field()
+    """Descripton of the endpoint."""
+    scoring_uri: Optional[str] = rest_field(visibility=["read"])
+    """Scoring uri of the endpoint."""
+    id: Optional[str] = rest_field(visibility=["read"])
+    """ARM resource id of the endpoint."""
+    headers: Optional[Dict[str, str]] = rest_field(visibility=["read"])
+    """Headers required to hit the endpoint."""
+
+    @overload
+    def __init__(
+        self,
+        *,
+        name: str,
+        model_id: str,
+        auth_mode: Optional[str] = None,
+        tags: Optional[Dict[str, str]] = None,
+        properties: Optional[Dict[str, str]] = None,
+        description: Optional[str] = None,
+    ): ...
+
+    @overload
+    def __init__(self, mapping: Mapping[str, Any]):
+        """
+        :param mapping: raw JSON to initialize the model.
+        :type mapping: Mapping[str, Any]
+        """
+
+    def __init__(self, *args: Any, **kwargs: Any) -> None:  # pylint: disable=useless-super-delegation
+        super().__init__(*args, **kwargs)
diff --git a/.venv/lib/python3.12/site-packages/azure/ai/ml/entities/_autogen_entities/models/_patch.py b/.venv/lib/python3.12/site-packages/azure/ai/ml/entities/_autogen_entities/models/_patch.py
new file mode 100644
index 00000000..da29aeb3
--- /dev/null
+++ b/.venv/lib/python3.12/site-packages/azure/ai/ml/entities/_autogen_entities/models/_patch.py
@@ -0,0 +1,223 @@
+# ------------------------------------
+# Copyright (c) Microsoft Corporation.
+# Licensed under the MIT License.
+# ------------------------------------
+
+# pylint: disable=protected-access
+
+"""Customize generated code here.
+
+Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize
+"""
+import json
+from typing import Any, Dict, List, Optional
+
+from azure.ai.ml._restclient.v2024_01_01_preview.models import MarketplaceSubscription as RestMarketplaceSubscription
+from azure.ai.ml._restclient.v2024_01_01_preview.models import (
+    MarketplaceSubscriptionProperties as RestMarketplaceSubscriptionProperties,
+)
+from azure.ai.ml._restclient.v2024_01_01_preview.models import ModelSettings as RestModelSettings
+from azure.ai.ml._restclient.v2024_01_01_preview.models import ServerlessEndpoint as RestServerlessEndpoint
+from azure.ai.ml._restclient.v2024_01_01_preview.models import (
+    ServerlessEndpointProperties as RestServerlessEndpointProperties,
+)
+from azure.ai.ml._restclient.v2024_01_01_preview.models import Sku as RestSku
+from azure.ai.ml._restclient.v2024_04_01_preview.models import (
+    EndpointDeploymentResourcePropertiesBasicResource,
+    OpenAIEndpointDeploymentResourceProperties,
+)
+from azure.ai.ml._utils._experimental import experimental
+from azure.ai.ml._utils.utils import camel_to_snake
+from azure.ai.ml.entities._system_data import SystemData
+
+from .._model_base import rest_field
+from ._models import AzureOpenAIDeployment as _AzureOpenAIDeployment
+from ._models import MarketplacePlan as _MarketplacePlan
+from ._models import MarketplaceSubscription as _MarketplaceSubscription
+from ._models import ServerlessEndpoint as _ServerlessEndpoint
+
+__all__: List[str] = [
+    "AzureOpenAIDeployment",
+    "ServerlessEndpoint",
+    "MarketplaceSubscription",
+    "MarketplacePlan",
+]  # Add all objects you want publicly available to users at this package level
+
+_NULL = object()
+
+
+func_to_attr_type = {
+    "_deserialize_dict": dict,
+    "_deserialize_sequence": list,
+}
+
+
+def _get_rest_field_type(field):
+    if hasattr(field, "_type"):
+        if field._type.func.__name__ == "_deserialize_default":
+            return field._type.args[0]
+        if func_to_attr_type.get(field._type.func.__name__):
+            return func_to_attr_type[field._type.func.__name__]
+        return _get_rest_field_type(field._type.args[0])
+    if hasattr(field, "func") and func_to_attr_type.get(field.func.__name__):
+        return func_to_attr_type[field.func.__name__]
+    if hasattr(field, "args"):
+        return _get_rest_field_type(field.args[0])
+    return field
+
+
+class ValidationMixin:
+    def _validate(self) -> None:
+        # verify types
+        for attr, field in self._attr_to_rest_field.items():  # type: ignore
+            try:
+                attr_value = self.__getitem__(attr)  # type: ignore
+                attr_type = type(attr_value)
+            except KeyError as exc:
+                if field._visibility and "read" in field._visibility:
+                    # read-only field, no need to validate
+                    continue
+                if field._type.func.__name__ != "_deserialize_with_optional":
+                    # i'm required
+                    raise ValueError(f"attr {attr} is a required property for {self.__class__.__name__}") from exc
+            else:
+                if getattr(attr_value, "_is_model", False):
+                    attr_value._validate()
+                rest_field_type = _get_rest_field_type(field)
+                if attr_type != rest_field_type:
+                    raise ValueError(f"Type of attr {attr} is of type {attr_type}, not {rest_field_type}")
+
+
+@experimental
+class AzureOpenAIDeployment(_AzureOpenAIDeployment):
+
+    system_data: Optional[SystemData] = rest_field(visibility=["read"])
+    """System data of the deployment."""
+
+    @classmethod
+    def _from_rest_object(cls, obj: EndpointDeploymentResourcePropertiesBasicResource) -> "AzureOpenAIDeployment":
+        properties: OpenAIEndpointDeploymentResourceProperties = obj.properties
+        return cls(
+            name=obj.name,
+            model_name=properties.model.name,
+            model_version=properties.model.version,
+            id=obj.id,
+            system_data=SystemData._from_rest_object(obj.system_data),
+        )
+
+    def as_dict(self, *, exclude_readonly: bool = False) -> Dict[str, Any]:
+        d = super().as_dict(exclude_readonly=exclude_readonly)
+        d["system_data"] = json.loads(json.dumps(self.system_data._to_dict()))  # type: ignore
+        return d
+
+
+AzureOpenAIDeployment.__doc__ += (
+    _AzureOpenAIDeployment.__doc__.strip()  # type: ignore
+    + """
+    :ivar system_data: System data of the deployment.
+    :vartype system_data: ~azure.ai.ml.entities.SystemData
+"""
+)
+
+
+@experimental
+class MarketplacePlan(_MarketplacePlan):
+    pass
+
+
+@experimental
+class ServerlessEndpoint(_ServerlessEndpoint, ValidationMixin):
+
+    system_data: Optional[SystemData] = rest_field(visibility=["read"])
+    """System data of the endpoint."""
+
+    def _to_rest_object(self) -> RestServerlessEndpoint:
+        return RestServerlessEndpoint(
+            properties=RestServerlessEndpointProperties(
+                model_settings=RestModelSettings(model_id=self.model_id),
+            ),
+            auth_mode="key",  # only key is supported for now
+            tags=self.tags,
+            sku=RestSku(name="Consumption"),
+            location=self.location,
+        )
+
+    @classmethod
+    def _from_rest_object(cls, obj: RestServerlessEndpoint) -> "ServerlessEndpoint":
+        return cls(  # type: ignore
+            name=obj.name,
+            id=obj.id,
+            tags=obj.tags,
+            location=obj.location,
+            auth_mode=obj.properties.auth_mode,
+            provisioning_state=camel_to_snake(obj.properties.provisioning_state),
+            model_id=obj.properties.model_settings.model_id if obj.properties.model_settings else None,
+            scoring_uri=obj.properties.inference_endpoint.uri if obj.properties.inference_endpoint else None,
+            system_data=SystemData._from_rest_object(obj.system_data) if obj.system_data else None,
+            headers=obj.properties.inference_endpoint.headers if obj.properties.inference_endpoint else None,
+        )
+
+    def as_dict(self, *, exclude_readonly: bool = False) -> Dict[str, Any]:
+        d = super().as_dict(exclude_readonly=exclude_readonly)
+        d["system_data"] = json.loads(json.dumps(self.system_data._to_dict()))  # type: ignore
+        return d
+
+
+ServerlessEndpoint.__doc__ += (
+    _ServerlessEndpoint.__doc__.strip()  # type: ignore
+    + """
+    :ivar system_data: System data of the endpoint.
+    :vartype system_data: ~azure.ai.ml.entities.SystemData
+"""
+)
+
+
+@experimental
+class MarketplaceSubscription(_MarketplaceSubscription, ValidationMixin):
+
+    system_data: Optional[SystemData] = rest_field(visibility=["read"])
+    """System data of the endpoint."""
+
+    def _to_rest_object(self) -> RestMarketplaceSubscription:
+        return RestMarketplaceSubscription(properties=RestMarketplaceSubscriptionProperties(model_id=self.model_id))
+
+    @classmethod
+    def _from_rest_object(cls, obj: RestMarketplaceSubscription) -> "MarketplaceSubscription":
+        properties = obj.properties
+        return cls(  # type: ignore
+            name=obj.name,
+            id=obj.id,
+            model_id=properties.model_id,
+            marketplace_plan=MarketplacePlan(
+                publisher_id=properties.marketplace_plan.publisher_id,
+                offer_id=properties.marketplace_plan.offer_id,
+                plan_id=properties.marketplace_plan.plan_id,
+            ),
+            status=camel_to_snake(properties.marketplace_subscription_status),
+            provisioning_state=camel_to_snake(properties.provisioning_state),
+            system_data=SystemData._from_rest_object(obj.system_data) if obj.system_data else None,
+        )
+
+    def as_dict(self, *, exclude_readonly: bool = False) -> Dict[str, Any]:
+        d = super().as_dict(exclude_readonly=exclude_readonly)
+        if self.system_data:
+            d["system_data"] = json.loads(json.dumps(self.system_data._to_dict()))
+        return d
+
+
+MarketplaceSubscription.__doc__ = (
+    _MarketplaceSubscription.__doc__.strip()  # type: ignore
+    + """
+    :ivar system_data: System data of the marketplace subscription.
+    :vartype system_data: ~azure.ai.ml.entities.SystemData
+"""
+)
+
+
+def patch_sdk():
+    """Do not remove from this file.
+
+    `patch_sdk` is a last resort escape hatch that allows you to do customizations
+    you can't accomplish using the techniques described in
+    https://aka.ms/azsdk/python/dpcodegen/python/customize
+    """