|
12 | 12 | import json |
13 | 13 | from typing import Any, Dict, List, Optional |
14 | 14 |
|
15 | | -from azure.ai.ml.entities._system_data import SystemData |
16 | | -from azure.ai.ml._utils._experimental import experimental |
| 15 | +from azure.ai.ml._restclient.v2024_01_01_preview.models import MarketplaceSubscription as RestMarketplaceSubscription |
| 16 | +from azure.ai.ml._restclient.v2024_01_01_preview.models import ( |
| 17 | + MarketplaceSubscriptionProperties as RestMarketplaceSubscriptionProperties, |
| 18 | +) |
| 19 | +from azure.ai.ml._restclient.v2024_01_01_preview.models import ModelSettings as RestModelSettings |
| 20 | +from azure.ai.ml._restclient.v2024_01_01_preview.models import ServerlessEndpoint as RestServerlessEndpoint |
| 21 | +from azure.ai.ml._restclient.v2024_01_01_preview.models import ( |
| 22 | + ServerlessEndpointProperties as RestServerlessEndpointProperties, |
| 23 | +) |
| 24 | +from azure.ai.ml._restclient.v2024_01_01_preview.models import Sku as RestSku |
17 | 25 | from azure.ai.ml._restclient.v2024_04_01_preview.models import ( |
18 | 26 | EndpointDeploymentResourcePropertiesBasicResource, |
19 | 27 | OpenAIEndpointDeploymentResourceProperties, |
20 | 28 | ) |
| 29 | +from azure.ai.ml._utils._experimental import experimental |
21 | 30 | from azure.ai.ml._utils.utils import camel_to_snake |
22 | | -from azure.ai.ml._restclient.v2024_01_01_preview.models import ( |
23 | | - ServerlessEndpoint as RestServerlessEndpoint, |
24 | | - ServerlessEndpointProperties as RestServerlessEndpointProperties, |
25 | | - ModelSettings as RestModelSettings, |
26 | | - Sku as RestSku, |
27 | | - MarketplaceSubscription as RestMarketplaceSubscription, |
28 | | - MarketplaceSubscriptionProperties as RestMarketplaceSubscriptionProperties, |
29 | | -) |
| 31 | +from azure.ai.ml.entities._system_data import SystemData |
30 | 32 |
|
31 | | -from ._models import ( |
32 | | - AzureOpenAIDeployment as _AzureOpenAIDeployment, |
33 | | - ServerlessEndpoint as _ServerlessEndpoint, |
34 | | - MarketplaceSubscription as _MarketplaceSubscription, |
35 | | - MarketplacePlan as _MarketplacePlan, |
36 | | -) |
37 | 33 | from .._model_base import rest_field |
| 34 | +from ._models import AzureOpenAIDeployment as _AzureOpenAIDeployment |
| 35 | +from ._models import MarketplacePlan as _MarketplacePlan |
| 36 | +from ._models import MarketplaceSubscription as _MarketplaceSubscription |
| 37 | +from ._models import ServerlessEndpoint as _ServerlessEndpoint |
38 | 38 |
|
39 | 39 | __all__: List[str] = [ |
40 | 40 | "AzureOpenAIDeployment", |
@@ -151,10 +151,10 @@ def _from_rest_object(cls, obj: RestServerlessEndpoint) -> "ServerlessEndpoint": |
151 | 151 | location=obj.location, |
152 | 152 | auth_mode=obj.properties.auth_mode, |
153 | 153 | provisioning_state=camel_to_snake(obj.properties.provisioning_state), |
154 | | - model_id=obj.properties.model_settings.model_id, |
155 | | - scoring_uri=obj.properties.inference_endpoint.uri, |
156 | | - system_data=SystemData._from_rest_object(obj.system_data), |
157 | | - headers=obj.properties.inference_endpoint.headers, |
| 154 | + model_id=obj.properties.model_settings.model_id if obj.properties.model_settings else None, |
| 155 | + scoring_uri=obj.properties.inference_endpoint.uri if obj.properties.inference_endpoint else None, |
| 156 | + system_data=SystemData._from_rest_object(obj.system_data) if obj.system_data else None, |
| 157 | + headers=obj.properties.inference_endpoint.headers if obj.properties.inference_endpoint else None, |
158 | 158 | ) |
159 | 159 |
|
160 | 160 | def as_dict(self, *, exclude_readonly: bool = False) -> Dict[str, Any]: |
|
0 commit comments