azure-ai-evaluation 1.3.0__py3-none-any.whl → 1.4.0__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.
Potentially problematic release.
This version of azure-ai-evaluation might be problematic. Click here for more details.
- azure/ai/evaluation/__init__.py +43 -1
- azure/ai/evaluation/_azure/_models.py +6 -6
- azure/ai/evaluation/_common/constants.py +6 -2
- azure/ai/evaluation/_common/rai_service.py +38 -4
- azure/ai/evaluation/_common/raiclient/__init__.py +34 -0
- azure/ai/evaluation/_common/raiclient/_client.py +128 -0
- azure/ai/evaluation/_common/raiclient/_configuration.py +87 -0
- azure/ai/evaluation/_common/raiclient/_model_base.py +1235 -0
- azure/ai/evaluation/_common/raiclient/_patch.py +20 -0
- azure/ai/evaluation/_common/raiclient/_serialization.py +2050 -0
- azure/ai/evaluation/_common/raiclient/_version.py +9 -0
- azure/ai/evaluation/_common/raiclient/aio/__init__.py +29 -0
- azure/ai/evaluation/_common/raiclient/aio/_client.py +130 -0
- azure/ai/evaluation/_common/raiclient/aio/_configuration.py +87 -0
- azure/ai/evaluation/_common/raiclient/aio/_patch.py +20 -0
- azure/ai/evaluation/_common/raiclient/aio/operations/__init__.py +25 -0
- azure/ai/evaluation/_common/raiclient/aio/operations/_operations.py +981 -0
- azure/ai/evaluation/_common/raiclient/aio/operations/_patch.py +20 -0
- azure/ai/evaluation/_common/raiclient/models/__init__.py +60 -0
- azure/ai/evaluation/_common/raiclient/models/_enums.py +18 -0
- azure/ai/evaluation/_common/raiclient/models/_models.py +651 -0
- azure/ai/evaluation/_common/raiclient/models/_patch.py +20 -0
- azure/ai/evaluation/_common/raiclient/operations/__init__.py +25 -0
- azure/ai/evaluation/_common/raiclient/operations/_operations.py +1225 -0
- azure/ai/evaluation/_common/raiclient/operations/_patch.py +20 -0
- azure/ai/evaluation/_common/raiclient/py.typed +1 -0
- azure/ai/evaluation/_common/utils.py +22 -2
- azure/ai/evaluation/_constants.py +7 -0
- azure/ai/evaluation/_converters/__init__.py +3 -0
- azure/ai/evaluation/_converters/_ai_services.py +804 -0
- azure/ai/evaluation/_converters/_models.py +302 -0
- azure/ai/evaluation/_evaluate/_batch_run/__init__.py +10 -3
- azure/ai/evaluation/_evaluate/_batch_run/_run_submitter_client.py +104 -0
- azure/ai/evaluation/_evaluate/_batch_run/batch_clients.py +82 -0
- azure/ai/evaluation/_evaluate/_eval_run.py +1 -1
- azure/ai/evaluation/_evaluate/_evaluate.py +31 -2
- azure/ai/evaluation/_evaluators/_bleu/_bleu.py +23 -3
- azure/ai/evaluation/_evaluators/_code_vulnerability/__init__.py +5 -0
- azure/ai/evaluation/_evaluators/_code_vulnerability/_code_vulnerability.py +120 -0
- azure/ai/evaluation/_evaluators/_coherence/_coherence.py +21 -2
- azure/ai/evaluation/_evaluators/_common/_base_eval.py +43 -3
- azure/ai/evaluation/_evaluators/_common/_base_multi_eval.py +3 -1
- azure/ai/evaluation/_evaluators/_common/_base_prompty_eval.py +43 -4
- azure/ai/evaluation/_evaluators/_common/_base_rai_svc_eval.py +16 -4
- azure/ai/evaluation/_evaluators/_content_safety/_content_safety.py +42 -5
- azure/ai/evaluation/_evaluators/_content_safety/_hate_unfairness.py +15 -0
- azure/ai/evaluation/_evaluators/_content_safety/_self_harm.py +15 -0
- azure/ai/evaluation/_evaluators/_content_safety/_sexual.py +15 -0
- azure/ai/evaluation/_evaluators/_content_safety/_violence.py +15 -0
- azure/ai/evaluation/_evaluators/_f1_score/_f1_score.py +28 -4
- azure/ai/evaluation/_evaluators/_fluency/_fluency.py +21 -2
- azure/ai/evaluation/_evaluators/_gleu/_gleu.py +26 -3
- azure/ai/evaluation/_evaluators/_groundedness/_groundedness.py +21 -3
- azure/ai/evaluation/_evaluators/_intent_resolution/__init__.py +7 -0
- azure/ai/evaluation/_evaluators/_intent_resolution/_intent_resolution.py +152 -0
- azure/ai/evaluation/_evaluators/_intent_resolution/intent_resolution.prompty +161 -0
- azure/ai/evaluation/_evaluators/_meteor/_meteor.py +26 -3
- azure/ai/evaluation/_evaluators/_qa/_qa.py +51 -7
- azure/ai/evaluation/_evaluators/_relevance/_relevance.py +26 -2
- azure/ai/evaluation/_evaluators/_response_completeness/__init__.py +7 -0
- azure/ai/evaluation/_evaluators/_response_completeness/_response_completeness.py +157 -0
- azure/ai/evaluation/_evaluators/_response_completeness/response_completeness.prompty +99 -0
- azure/ai/evaluation/_evaluators/_retrieval/_retrieval.py +21 -2
- azure/ai/evaluation/_evaluators/_rouge/_rouge.py +113 -4
- azure/ai/evaluation/_evaluators/_service_groundedness/_service_groundedness.py +23 -3
- azure/ai/evaluation/_evaluators/_similarity/_similarity.py +24 -5
- azure/ai/evaluation/_evaluators/_task_adherence/__init__.py +7 -0
- azure/ai/evaluation/_evaluators/_task_adherence/_task_adherence.py +148 -0
- azure/ai/evaluation/_evaluators/_task_adherence/task_adherence.prompty +117 -0
- azure/ai/evaluation/_evaluators/_tool_call_accuracy/__init__.py +9 -0
- azure/ai/evaluation/_evaluators/_tool_call_accuracy/_tool_call_accuracy.py +292 -0
- azure/ai/evaluation/_evaluators/_tool_call_accuracy/tool_call_accuracy.prompty +71 -0
- azure/ai/evaluation/_evaluators/_ungrounded_attributes/__init__.py +5 -0
- azure/ai/evaluation/_evaluators/_ungrounded_attributes/_ungrounded_attributes.py +103 -0
- azure/ai/evaluation/_evaluators/_xpia/xpia.py +2 -0
- azure/ai/evaluation/_exceptions.py +5 -0
- azure/ai/evaluation/_legacy/__init__.py +3 -0
- azure/ai/evaluation/_legacy/_batch_engine/__init__.py +9 -0
- azure/ai/evaluation/_legacy/_batch_engine/_config.py +45 -0
- azure/ai/evaluation/_legacy/_batch_engine/_engine.py +368 -0
- azure/ai/evaluation/_legacy/_batch_engine/_exceptions.py +88 -0
- azure/ai/evaluation/_legacy/_batch_engine/_logging.py +292 -0
- azure/ai/evaluation/_legacy/_batch_engine/_openai_injector.py +23 -0
- azure/ai/evaluation/_legacy/_batch_engine/_result.py +99 -0
- azure/ai/evaluation/_legacy/_batch_engine/_run.py +121 -0
- azure/ai/evaluation/_legacy/_batch_engine/_run_storage.py +128 -0
- azure/ai/evaluation/_legacy/_batch_engine/_run_submitter.py +217 -0
- azure/ai/evaluation/_legacy/_batch_engine/_status.py +25 -0
- azure/ai/evaluation/_legacy/_batch_engine/_trace.py +105 -0
- azure/ai/evaluation/_legacy/_batch_engine/_utils.py +82 -0
- azure/ai/evaluation/_legacy/_batch_engine/_utils_deprecated.py +131 -0
- azure/ai/evaluation/_legacy/prompty/__init__.py +36 -0
- azure/ai/evaluation/_legacy/prompty/_connection.py +182 -0
- azure/ai/evaluation/_legacy/prompty/_exceptions.py +59 -0
- azure/ai/evaluation/_legacy/prompty/_prompty.py +313 -0
- azure/ai/evaluation/_legacy/prompty/_utils.py +545 -0
- azure/ai/evaluation/_legacy/prompty/_yaml_utils.py +99 -0
- azure/ai/evaluation/_red_team/__init__.py +3 -0
- azure/ai/evaluation/_red_team/_attack_objective_generator.py +192 -0
- azure/ai/evaluation/_red_team/_attack_strategy.py +42 -0
- azure/ai/evaluation/_red_team/_callback_chat_target.py +74 -0
- azure/ai/evaluation/_red_team/_default_converter.py +21 -0
- azure/ai/evaluation/_red_team/_red_team.py +1858 -0
- azure/ai/evaluation/_red_team/_red_team_result.py +246 -0
- azure/ai/evaluation/_red_team/_utils/__init__.py +3 -0
- azure/ai/evaluation/_red_team/_utils/constants.py +64 -0
- azure/ai/evaluation/_red_team/_utils/formatting_utils.py +164 -0
- azure/ai/evaluation/_red_team/_utils/logging_utils.py +139 -0
- azure/ai/evaluation/_red_team/_utils/strategy_utils.py +188 -0
- azure/ai/evaluation/_safety_evaluation/__init__.py +1 -1
- azure/ai/evaluation/_safety_evaluation/_generated_rai_client.py +0 -0
- azure/ai/evaluation/_safety_evaluation/_safety_evaluation.py +251 -150
- azure/ai/evaluation/_version.py +1 -1
- azure/ai/evaluation/simulator/_adversarial_scenario.py +3 -1
- azure/ai/evaluation/simulator/_adversarial_simulator.py +54 -27
- azure/ai/evaluation/simulator/_model_tools/_generated_rai_client.py +145 -0
- azure/ai/evaluation/simulator/_model_tools/_rai_client.py +71 -1
- {azure_ai_evaluation-1.3.0.dist-info → azure_ai_evaluation-1.4.0.dist-info}/METADATA +69 -15
- azure_ai_evaluation-1.4.0.dist-info/RECORD +197 -0
- {azure_ai_evaluation-1.3.0.dist-info → azure_ai_evaluation-1.4.0.dist-info}/WHEEL +1 -1
- azure_ai_evaluation-1.3.0.dist-info/RECORD +0 -119
- {azure_ai_evaluation-1.3.0.dist-info → azure_ai_evaluation-1.4.0.dist-info}/NOTICE.txt +0 -0
- {azure_ai_evaluation-1.3.0.dist-info → azure_ai_evaluation-1.4.0.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# coding=utf-8
|
|
2
|
+
# --------------------------------------------------------------------------
|
|
3
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
+
# Licensed under the MIT License. See License.txt in the project root for license information.
|
|
5
|
+
# Code generated by Microsoft (R) Python Code Generator.
|
|
6
|
+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
7
|
+
# --------------------------------------------------------------------------
|
|
8
|
+
|
|
9
|
+
VERSION = "1.0.0b1"
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# coding=utf-8
|
|
2
|
+
# --------------------------------------------------------------------------
|
|
3
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
+
# Licensed under the MIT License. See License.txt in the project root for license information.
|
|
5
|
+
# Code generated by Microsoft (R) Python Code Generator.
|
|
6
|
+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
7
|
+
# --------------------------------------------------------------------------
|
|
8
|
+
# pylint: disable=wrong-import-position
|
|
9
|
+
|
|
10
|
+
from typing import TYPE_CHECKING
|
|
11
|
+
|
|
12
|
+
if TYPE_CHECKING:
|
|
13
|
+
from ._patch import * # pylint: disable=unused-wildcard-import
|
|
14
|
+
|
|
15
|
+
from ._client import MachineLearningServicesClient # type: ignore
|
|
16
|
+
|
|
17
|
+
try:
|
|
18
|
+
from ._patch import __all__ as _patch_all
|
|
19
|
+
from ._patch import *
|
|
20
|
+
except ImportError:
|
|
21
|
+
_patch_all = []
|
|
22
|
+
from ._patch import patch_sdk as _patch_sdk
|
|
23
|
+
|
|
24
|
+
__all__ = [
|
|
25
|
+
"MachineLearningServicesClient",
|
|
26
|
+
]
|
|
27
|
+
__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
|
|
28
|
+
|
|
29
|
+
_patch_sdk()
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
# pylint: disable=line-too-long,useless-suppression
|
|
2
|
+
# coding=utf-8
|
|
3
|
+
# --------------------------------------------------------------------------
|
|
4
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5
|
+
# Licensed under the MIT License. See License.txt in the project root for license information.
|
|
6
|
+
# Code generated by Microsoft (R) Python Code Generator.
|
|
7
|
+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
8
|
+
# --------------------------------------------------------------------------
|
|
9
|
+
|
|
10
|
+
from copy import deepcopy
|
|
11
|
+
from typing import Any, Awaitable, TYPE_CHECKING
|
|
12
|
+
from typing_extensions import Self
|
|
13
|
+
|
|
14
|
+
from azure.core import AsyncPipelineClient
|
|
15
|
+
from azure.core.pipeline import policies
|
|
16
|
+
from azure.core.rest import AsyncHttpResponse, HttpRequest
|
|
17
|
+
|
|
18
|
+
from .._serialization import Deserializer, Serializer
|
|
19
|
+
from ._configuration import MachineLearningServicesClientConfiguration
|
|
20
|
+
from .operations import RAISvcOperations
|
|
21
|
+
|
|
22
|
+
if TYPE_CHECKING:
|
|
23
|
+
from azure.core.credentials_async import AsyncTokenCredential
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class MachineLearningServicesClient:
|
|
27
|
+
"""MachineLearningServicesClient.
|
|
28
|
+
|
|
29
|
+
:ivar rai_svc: RAISvcOperations operations
|
|
30
|
+
:vartype rai_svc: raiclient.aio.operations.RAISvcOperations
|
|
31
|
+
:param endpoint: Supported Azure-AI endpoints. Required.
|
|
32
|
+
:type endpoint: str
|
|
33
|
+
:param subscription_id: The ID of the target subscription. Required.
|
|
34
|
+
:type subscription_id: str
|
|
35
|
+
:param resource_group_name: The name of the Resource Group. Required.
|
|
36
|
+
:type resource_group_name: str
|
|
37
|
+
:param workspace_name: The name of the AzureML workspace or AI project. Required.
|
|
38
|
+
:type workspace_name: str
|
|
39
|
+
:param credential: Credential used to authenticate requests to the service. Required.
|
|
40
|
+
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
|
|
41
|
+
:keyword api_version: The API version to use for this operation. Default value is
|
|
42
|
+
"2022-11-01-preview". Note that overriding this default value may result in unsupported
|
|
43
|
+
behavior.
|
|
44
|
+
:paramtype api_version: str
|
|
45
|
+
"""
|
|
46
|
+
|
|
47
|
+
def __init__(
|
|
48
|
+
self,
|
|
49
|
+
endpoint: str,
|
|
50
|
+
subscription_id: str,
|
|
51
|
+
resource_group_name: str,
|
|
52
|
+
workspace_name: str,
|
|
53
|
+
credential: "AsyncTokenCredential",
|
|
54
|
+
**kwargs: Any
|
|
55
|
+
) -> None:
|
|
56
|
+
_endpoint = "{endpoint}/raisvc/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}"
|
|
57
|
+
self._config = MachineLearningServicesClientConfiguration(
|
|
58
|
+
endpoint=endpoint,
|
|
59
|
+
subscription_id=subscription_id,
|
|
60
|
+
resource_group_name=resource_group_name,
|
|
61
|
+
workspace_name=workspace_name,
|
|
62
|
+
credential=credential,
|
|
63
|
+
**kwargs
|
|
64
|
+
)
|
|
65
|
+
_policies = kwargs.pop("policies", None)
|
|
66
|
+
if _policies is None:
|
|
67
|
+
_policies = [
|
|
68
|
+
policies.RequestIdPolicy(**kwargs),
|
|
69
|
+
self._config.headers_policy,
|
|
70
|
+
self._config.user_agent_policy,
|
|
71
|
+
self._config.proxy_policy,
|
|
72
|
+
policies.ContentDecodePolicy(**kwargs),
|
|
73
|
+
self._config.redirect_policy,
|
|
74
|
+
self._config.retry_policy,
|
|
75
|
+
self._config.authentication_policy,
|
|
76
|
+
self._config.custom_hook_policy,
|
|
77
|
+
self._config.logging_policy,
|
|
78
|
+
policies.DistributedTracingPolicy(**kwargs),
|
|
79
|
+
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
|
|
80
|
+
self._config.http_logging_policy,
|
|
81
|
+
]
|
|
82
|
+
self._client: AsyncPipelineClient = AsyncPipelineClient(base_url=_endpoint, policies=_policies, **kwargs)
|
|
83
|
+
|
|
84
|
+
self._serialize = Serializer()
|
|
85
|
+
self._deserialize = Deserializer()
|
|
86
|
+
self._serialize.client_side_validation = False
|
|
87
|
+
self.rai_svc = RAISvcOperations(self._client, self._config, self._serialize, self._deserialize)
|
|
88
|
+
|
|
89
|
+
def send_request(
|
|
90
|
+
self, request: HttpRequest, *, stream: bool = False, **kwargs: Any
|
|
91
|
+
) -> Awaitable[AsyncHttpResponse]:
|
|
92
|
+
"""Runs the network request through the client's chained policies.
|
|
93
|
+
|
|
94
|
+
>>> from azure.core.rest import HttpRequest
|
|
95
|
+
>>> request = HttpRequest("GET", "https://www.example.org/")
|
|
96
|
+
<HttpRequest [GET], url: 'https://www.example.org/'>
|
|
97
|
+
>>> response = await client.send_request(request)
|
|
98
|
+
<AsyncHttpResponse: 200 OK>
|
|
99
|
+
|
|
100
|
+
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
|
|
101
|
+
|
|
102
|
+
:param request: The network request you want to make. Required.
|
|
103
|
+
:type request: ~azure.core.rest.HttpRequest
|
|
104
|
+
:keyword bool stream: Whether the response payload will be streamed. Defaults to False.
|
|
105
|
+
:return: The response of your network call. Does not do error handling on your response.
|
|
106
|
+
:rtype: ~azure.core.rest.AsyncHttpResponse
|
|
107
|
+
"""
|
|
108
|
+
|
|
109
|
+
request_copy = deepcopy(request)
|
|
110
|
+
path_format_arguments = {
|
|
111
|
+
"endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True),
|
|
112
|
+
"subscriptionId": self._serialize.url("self._config.subscription_id", self._config.subscription_id, "str"),
|
|
113
|
+
"resourceGroupName": self._serialize.url(
|
|
114
|
+
"self._config.resource_group_name", self._config.resource_group_name, "str"
|
|
115
|
+
),
|
|
116
|
+
"workspaceName": self._serialize.url("self._config.workspace_name", self._config.workspace_name, "str"),
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments)
|
|
120
|
+
return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
|
|
121
|
+
|
|
122
|
+
async def close(self) -> None:
|
|
123
|
+
await self._client.close()
|
|
124
|
+
|
|
125
|
+
async def __aenter__(self) -> Self:
|
|
126
|
+
await self._client.__aenter__()
|
|
127
|
+
return self
|
|
128
|
+
|
|
129
|
+
async def __aexit__(self, *exc_details: Any) -> None:
|
|
130
|
+
await self._client.__aexit__(*exc_details)
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# coding=utf-8
|
|
2
|
+
# --------------------------------------------------------------------------
|
|
3
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
+
# Licensed under the MIT License. See License.txt in the project root for license information.
|
|
5
|
+
# Code generated by Microsoft (R) Python Code Generator.
|
|
6
|
+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
7
|
+
# --------------------------------------------------------------------------
|
|
8
|
+
|
|
9
|
+
from typing import Any, TYPE_CHECKING
|
|
10
|
+
|
|
11
|
+
from azure.core.pipeline import policies
|
|
12
|
+
|
|
13
|
+
from .._version import VERSION
|
|
14
|
+
|
|
15
|
+
if TYPE_CHECKING:
|
|
16
|
+
from azure.core.credentials_async import AsyncTokenCredential
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class MachineLearningServicesClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
|
|
20
|
+
"""Configuration for MachineLearningServicesClient.
|
|
21
|
+
|
|
22
|
+
Note that all parameters used to create this instance are saved as instance
|
|
23
|
+
attributes.
|
|
24
|
+
|
|
25
|
+
:param endpoint: Supported Azure-AI endpoints. Required.
|
|
26
|
+
:type endpoint: str
|
|
27
|
+
:param subscription_id: The ID of the target subscription. Required.
|
|
28
|
+
:type subscription_id: str
|
|
29
|
+
:param resource_group_name: The name of the Resource Group. Required.
|
|
30
|
+
:type resource_group_name: str
|
|
31
|
+
:param workspace_name: The name of the AzureML workspace or AI project. Required.
|
|
32
|
+
:type workspace_name: str
|
|
33
|
+
:param credential: Credential used to authenticate requests to the service. Required.
|
|
34
|
+
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
|
|
35
|
+
:keyword api_version: The API version to use for this operation. Default value is
|
|
36
|
+
"2022-11-01-preview". Note that overriding this default value may result in unsupported
|
|
37
|
+
behavior.
|
|
38
|
+
:paramtype api_version: str
|
|
39
|
+
"""
|
|
40
|
+
|
|
41
|
+
def __init__(
|
|
42
|
+
self,
|
|
43
|
+
endpoint: str,
|
|
44
|
+
subscription_id: str,
|
|
45
|
+
resource_group_name: str,
|
|
46
|
+
workspace_name: str,
|
|
47
|
+
credential: "AsyncTokenCredential",
|
|
48
|
+
**kwargs: Any
|
|
49
|
+
) -> None:
|
|
50
|
+
api_version: str = kwargs.pop("api_version", "2022-11-01-preview")
|
|
51
|
+
|
|
52
|
+
if endpoint is None:
|
|
53
|
+
raise ValueError("Parameter 'endpoint' must not be None.")
|
|
54
|
+
if subscription_id is None:
|
|
55
|
+
raise ValueError("Parameter 'subscription_id' must not be None.")
|
|
56
|
+
if resource_group_name is None:
|
|
57
|
+
raise ValueError("Parameter 'resource_group_name' must not be None.")
|
|
58
|
+
if workspace_name is None:
|
|
59
|
+
raise ValueError("Parameter 'workspace_name' must not be None.")
|
|
60
|
+
if credential is None:
|
|
61
|
+
raise ValueError("Parameter 'credential' must not be None.")
|
|
62
|
+
|
|
63
|
+
self.endpoint = endpoint
|
|
64
|
+
self.subscription_id = subscription_id
|
|
65
|
+
self.resource_group_name = resource_group_name
|
|
66
|
+
self.workspace_name = workspace_name
|
|
67
|
+
self.credential = credential
|
|
68
|
+
self.api_version = api_version
|
|
69
|
+
self.credential_scopes = kwargs.pop("credential_scopes", ["https://ml.azure.com/.default"])
|
|
70
|
+
kwargs.setdefault("sdk_moniker", "rai_client/{}".format(VERSION))
|
|
71
|
+
self.polling_interval = kwargs.get("polling_interval", 30)
|
|
72
|
+
self._configure(**kwargs)
|
|
73
|
+
|
|
74
|
+
def _configure(self, **kwargs: Any) -> None:
|
|
75
|
+
self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs)
|
|
76
|
+
self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs)
|
|
77
|
+
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
|
|
78
|
+
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
|
|
79
|
+
self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs)
|
|
80
|
+
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
|
|
81
|
+
self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs)
|
|
82
|
+
self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs)
|
|
83
|
+
self.authentication_policy = kwargs.get("authentication_policy")
|
|
84
|
+
if self.credential and not self.authentication_policy:
|
|
85
|
+
self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(
|
|
86
|
+
self.credential, *self.credential_scopes, **kwargs
|
|
87
|
+
)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# ------------------------------------
|
|
2
|
+
# Copyright (c) Microsoft Corporation.
|
|
3
|
+
# Licensed under the MIT License.
|
|
4
|
+
# ------------------------------------
|
|
5
|
+
"""Customize generated code here.
|
|
6
|
+
|
|
7
|
+
Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize
|
|
8
|
+
"""
|
|
9
|
+
from typing import List
|
|
10
|
+
|
|
11
|
+
__all__: List[str] = [] # Add all objects you want publicly available to users at this package level
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def patch_sdk():
|
|
15
|
+
"""Do not remove from this file.
|
|
16
|
+
|
|
17
|
+
`patch_sdk` is a last resort escape hatch that allows you to do customizations
|
|
18
|
+
you can't accomplish using the techniques described in
|
|
19
|
+
https://aka.ms/azsdk/python/dpcodegen/python/customize
|
|
20
|
+
"""
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# coding=utf-8
|
|
2
|
+
# --------------------------------------------------------------------------
|
|
3
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
+
# Licensed under the MIT License. See License.txt in the project root for license information.
|
|
5
|
+
# Code generated by Microsoft (R) Python Code Generator.
|
|
6
|
+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
7
|
+
# --------------------------------------------------------------------------
|
|
8
|
+
# pylint: disable=wrong-import-position
|
|
9
|
+
|
|
10
|
+
from typing import TYPE_CHECKING
|
|
11
|
+
|
|
12
|
+
if TYPE_CHECKING:
|
|
13
|
+
from ._patch import * # pylint: disable=unused-wildcard-import
|
|
14
|
+
|
|
15
|
+
from ._operations import RAISvcOperations # type: ignore
|
|
16
|
+
|
|
17
|
+
from ._patch import __all__ as _patch_all
|
|
18
|
+
from ._patch import *
|
|
19
|
+
from ._patch import patch_sdk as _patch_sdk
|
|
20
|
+
|
|
21
|
+
__all__ = [
|
|
22
|
+
"RAISvcOperations",
|
|
23
|
+
]
|
|
24
|
+
__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
|
|
25
|
+
_patch_sdk()
|