azure-ai-evaluation 1.7.0__py3-none-any.whl → 1.9.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.
- azure/ai/evaluation/__init__.py +13 -2
- azure/ai/evaluation/_aoai/__init__.py +1 -1
- azure/ai/evaluation/_aoai/aoai_grader.py +21 -11
- azure/ai/evaluation/_aoai/label_grader.py +3 -2
- azure/ai/evaluation/_aoai/score_model_grader.py +90 -0
- azure/ai/evaluation/_aoai/string_check_grader.py +3 -2
- azure/ai/evaluation/_aoai/text_similarity_grader.py +3 -2
- azure/ai/evaluation/_azure/_envs.py +9 -10
- azure/ai/evaluation/_azure/_token_manager.py +7 -1
- azure/ai/evaluation/_common/constants.py +11 -2
- azure/ai/evaluation/_common/evaluation_onedp_client.py +32 -26
- azure/ai/evaluation/_common/onedp/__init__.py +32 -32
- azure/ai/evaluation/_common/onedp/_client.py +136 -139
- azure/ai/evaluation/_common/onedp/_configuration.py +70 -73
- azure/ai/evaluation/_common/onedp/_patch.py +21 -21
- azure/ai/evaluation/_common/onedp/_utils/__init__.py +6 -0
- azure/ai/evaluation/_common/onedp/_utils/model_base.py +1232 -0
- azure/ai/evaluation/_common/onedp/_utils/serialization.py +2032 -0
- azure/ai/evaluation/_common/onedp/_validation.py +50 -50
- azure/ai/evaluation/_common/onedp/_version.py +9 -9
- azure/ai/evaluation/_common/onedp/aio/__init__.py +29 -29
- azure/ai/evaluation/_common/onedp/aio/_client.py +138 -143
- azure/ai/evaluation/_common/onedp/aio/_configuration.py +70 -75
- azure/ai/evaluation/_common/onedp/aio/_patch.py +21 -21
- azure/ai/evaluation/_common/onedp/aio/operations/__init__.py +37 -39
- azure/ai/evaluation/_common/onedp/aio/operations/_operations.py +4832 -4494
- azure/ai/evaluation/_common/onedp/aio/operations/_patch.py +21 -21
- azure/ai/evaluation/_common/onedp/models/__init__.py +168 -142
- azure/ai/evaluation/_common/onedp/models/_enums.py +230 -162
- azure/ai/evaluation/_common/onedp/models/_models.py +2685 -2228
- azure/ai/evaluation/_common/onedp/models/_patch.py +21 -21
- azure/ai/evaluation/_common/onedp/operations/__init__.py +37 -39
- azure/ai/evaluation/_common/onedp/operations/_operations.py +6106 -5655
- azure/ai/evaluation/_common/onedp/operations/_patch.py +21 -21
- azure/ai/evaluation/_common/rai_service.py +86 -50
- azure/ai/evaluation/_common/raiclient/__init__.py +1 -1
- azure/ai/evaluation/_common/raiclient/operations/_operations.py +14 -1
- azure/ai/evaluation/_common/utils.py +124 -3
- azure/ai/evaluation/_constants.py +2 -1
- azure/ai/evaluation/_converters/__init__.py +1 -1
- azure/ai/evaluation/_converters/_ai_services.py +9 -8
- azure/ai/evaluation/_converters/_models.py +46 -0
- azure/ai/evaluation/_converters/_sk_services.py +495 -0
- azure/ai/evaluation/_eval_mapping.py +2 -2
- azure/ai/evaluation/_evaluate/_batch_run/_run_submitter_client.py +4 -4
- azure/ai/evaluation/_evaluate/_batch_run/eval_run_context.py +2 -2
- azure/ai/evaluation/_evaluate/_evaluate.py +64 -58
- azure/ai/evaluation/_evaluate/_evaluate_aoai.py +130 -89
- azure/ai/evaluation/_evaluate/_telemetry/__init__.py +0 -1
- azure/ai/evaluation/_evaluate/_utils.py +24 -15
- azure/ai/evaluation/_evaluators/_bleu/_bleu.py +3 -3
- azure/ai/evaluation/_evaluators/_code_vulnerability/_code_vulnerability.py +12 -11
- azure/ai/evaluation/_evaluators/_coherence/_coherence.py +5 -5
- azure/ai/evaluation/_evaluators/_common/_base_eval.py +15 -5
- azure/ai/evaluation/_evaluators/_common/_base_prompty_eval.py +24 -9
- azure/ai/evaluation/_evaluators/_common/_base_rai_svc_eval.py +6 -1
- azure/ai/evaluation/_evaluators/_content_safety/_content_safety.py +13 -13
- azure/ai/evaluation/_evaluators/_content_safety/_hate_unfairness.py +7 -7
- azure/ai/evaluation/_evaluators/_content_safety/_self_harm.py +7 -7
- azure/ai/evaluation/_evaluators/_content_safety/_sexual.py +7 -7
- azure/ai/evaluation/_evaluators/_content_safety/_violence.py +6 -6
- azure/ai/evaluation/_evaluators/_document_retrieval/__init__.py +1 -5
- azure/ai/evaluation/_evaluators/_document_retrieval/_document_retrieval.py +34 -64
- azure/ai/evaluation/_evaluators/_eci/_eci.py +3 -3
- azure/ai/evaluation/_evaluators/_f1_score/_f1_score.py +4 -4
- azure/ai/evaluation/_evaluators/_fluency/_fluency.py +2 -2
- azure/ai/evaluation/_evaluators/_gleu/_gleu.py +3 -3
- azure/ai/evaluation/_evaluators/_groundedness/_groundedness.py +11 -7
- azure/ai/evaluation/_evaluators/_intent_resolution/_intent_resolution.py +30 -25
- azure/ai/evaluation/_evaluators/_intent_resolution/intent_resolution.prompty +210 -96
- azure/ai/evaluation/_evaluators/_meteor/_meteor.py +2 -3
- azure/ai/evaluation/_evaluators/_protected_material/_protected_material.py +6 -6
- azure/ai/evaluation/_evaluators/_qa/_qa.py +4 -4
- azure/ai/evaluation/_evaluators/_relevance/_relevance.py +8 -13
- azure/ai/evaluation/_evaluators/_response_completeness/_response_completeness.py +20 -25
- azure/ai/evaluation/_evaluators/_retrieval/_retrieval.py +4 -4
- azure/ai/evaluation/_evaluators/_rouge/_rouge.py +25 -25
- azure/ai/evaluation/_evaluators/_service_groundedness/_service_groundedness.py +5 -5
- azure/ai/evaluation/_evaluators/_similarity/_similarity.py +3 -3
- azure/ai/evaluation/_evaluators/_task_adherence/_task_adherence.py +11 -14
- azure/ai/evaluation/_evaluators/_tool_call_accuracy/_tool_call_accuracy.py +43 -34
- azure/ai/evaluation/_evaluators/_tool_call_accuracy/tool_call_accuracy.prompty +3 -3
- azure/ai/evaluation/_evaluators/_ungrounded_attributes/_ungrounded_attributes.py +12 -11
- azure/ai/evaluation/_evaluators/_xpia/xpia.py +6 -6
- azure/ai/evaluation/_exceptions.py +10 -0
- azure/ai/evaluation/_http_utils.py +3 -3
- azure/ai/evaluation/_legacy/_batch_engine/_engine.py +3 -3
- azure/ai/evaluation/_legacy/_batch_engine/_openai_injector.py +5 -2
- azure/ai/evaluation/_legacy/_batch_engine/_run_submitter.py +5 -10
- azure/ai/evaluation/_legacy/_batch_engine/_utils.py +1 -4
- azure/ai/evaluation/_legacy/_common/_async_token_provider.py +12 -19
- azure/ai/evaluation/_legacy/_common/_thread_pool_executor_with_context.py +2 -0
- azure/ai/evaluation/_legacy/prompty/_prompty.py +11 -5
- azure/ai/evaluation/_safety_evaluation/__init__.py +1 -1
- azure/ai/evaluation/_safety_evaluation/_safety_evaluation.py +193 -111
- azure/ai/evaluation/_user_agent.py +32 -1
- azure/ai/evaluation/_version.py +1 -1
- azure/ai/evaluation/red_team/__init__.py +3 -1
- azure/ai/evaluation/red_team/_agent/__init__.py +3 -0
- azure/ai/evaluation/red_team/_agent/_agent_functions.py +261 -0
- azure/ai/evaluation/red_team/_agent/_agent_tools.py +461 -0
- azure/ai/evaluation/red_team/_agent/_agent_utils.py +89 -0
- azure/ai/evaluation/red_team/_agent/_semantic_kernel_plugin.py +228 -0
- azure/ai/evaluation/red_team/_attack_objective_generator.py +94 -52
- azure/ai/evaluation/red_team/_attack_strategy.py +4 -1
- azure/ai/evaluation/red_team/_callback_chat_target.py +4 -9
- azure/ai/evaluation/red_team/_default_converter.py +1 -1
- azure/ai/evaluation/red_team/_red_team.py +1622 -765
- azure/ai/evaluation/red_team/_red_team_result.py +43 -38
- azure/ai/evaluation/red_team/_utils/__init__.py +1 -1
- azure/ai/evaluation/red_team/_utils/_rai_service_eval_chat_target.py +121 -0
- azure/ai/evaluation/red_team/_utils/_rai_service_target.py +595 -0
- azure/ai/evaluation/red_team/_utils/_rai_service_true_false_scorer.py +108 -0
- azure/ai/evaluation/red_team/_utils/constants.py +6 -12
- azure/ai/evaluation/red_team/_utils/formatting_utils.py +41 -44
- azure/ai/evaluation/red_team/_utils/logging_utils.py +17 -17
- azure/ai/evaluation/red_team/_utils/metric_mapping.py +33 -6
- azure/ai/evaluation/red_team/_utils/strategy_utils.py +35 -25
- azure/ai/evaluation/simulator/_adversarial_scenario.py +2 -0
- azure/ai/evaluation/simulator/_adversarial_simulator.py +34 -16
- azure/ai/evaluation/simulator/_conversation/__init__.py +2 -2
- azure/ai/evaluation/simulator/_direct_attack_simulator.py +8 -8
- azure/ai/evaluation/simulator/_indirect_attack_simulator.py +5 -5
- azure/ai/evaluation/simulator/_model_tools/_generated_rai_client.py +54 -23
- azure/ai/evaluation/simulator/_model_tools/_identity_manager.py +7 -1
- azure/ai/evaluation/simulator/_model_tools/_proxy_completion_model.py +25 -15
- azure/ai/evaluation/simulator/_model_tools/_rai_client.py +19 -31
- azure/ai/evaluation/simulator/_model_tools/_template_handler.py +20 -6
- azure/ai/evaluation/simulator/_model_tools/models.py +1 -1
- azure/ai/evaluation/simulator/_simulator.py +9 -8
- {azure_ai_evaluation-1.7.0.dist-info → azure_ai_evaluation-1.9.0.dist-info}/METADATA +24 -1
- {azure_ai_evaluation-1.7.0.dist-info → azure_ai_evaluation-1.9.0.dist-info}/RECORD +135 -123
- azure/ai/evaluation/_common/onedp/aio/_vendor.py +0 -40
- {azure_ai_evaluation-1.7.0.dist-info → azure_ai_evaluation-1.9.0.dist-info}/NOTICE.txt +0 -0
- {azure_ai_evaluation-1.7.0.dist-info → azure_ai_evaluation-1.9.0.dist-info}/WHEEL +0 -0
- {azure_ai_evaluation-1.7.0.dist-info → azure_ai_evaluation-1.9.0.dist-info}/top_level.txt +0 -0
|
@@ -1,139 +1,136 @@
|
|
|
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 copy import deepcopy
|
|
10
|
-
from typing import Any, TYPE_CHECKING
|
|
11
|
-
from typing_extensions import Self
|
|
12
|
-
|
|
13
|
-
from azure.core import PipelineClient
|
|
14
|
-
from azure.core.
|
|
15
|
-
from azure.core.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
from .
|
|
19
|
-
from .
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
:ivar
|
|
39
|
-
:vartype
|
|
40
|
-
:ivar
|
|
41
|
-
:vartype
|
|
42
|
-
:ivar
|
|
43
|
-
:vartype
|
|
44
|
-
:ivar
|
|
45
|
-
:vartype
|
|
46
|
-
:ivar
|
|
47
|
-
:vartype
|
|
48
|
-
:ivar
|
|
49
|
-
:vartype
|
|
50
|
-
:
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
:
|
|
58
|
-
|
|
59
|
-
:type credential: ~azure.core.credentials.
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
_policies = kwargs.pop("policies", None)
|
|
71
|
-
if _policies is None:
|
|
72
|
-
_policies = [
|
|
73
|
-
policies.RequestIdPolicy(**kwargs),
|
|
74
|
-
self._config.headers_policy,
|
|
75
|
-
self._config.user_agent_policy,
|
|
76
|
-
self._config.proxy_policy,
|
|
77
|
-
policies.ContentDecodePolicy(**kwargs),
|
|
78
|
-
self._config.redirect_policy,
|
|
79
|
-
self._config.retry_policy,
|
|
80
|
-
self._config.authentication_policy,
|
|
81
|
-
self._config.custom_hook_policy,
|
|
82
|
-
self._config.logging_policy,
|
|
83
|
-
policies.DistributedTracingPolicy(**kwargs),
|
|
84
|
-
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
|
|
85
|
-
self._config.http_logging_policy,
|
|
86
|
-
]
|
|
87
|
-
self._client: PipelineClient = PipelineClient(base_url=_endpoint, policies=_policies, **kwargs)
|
|
88
|
-
|
|
89
|
-
self._serialize = Serializer()
|
|
90
|
-
self._deserialize = Deserializer()
|
|
91
|
-
self._serialize.client_side_validation = False
|
|
92
|
-
self.
|
|
93
|
-
|
|
94
|
-
)
|
|
95
|
-
self.
|
|
96
|
-
self.
|
|
97
|
-
self.
|
|
98
|
-
self.
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
>>>
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
:
|
|
117
|
-
:
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
def
|
|
132
|
-
self._client.
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
def __exit__(self, *exc_details: Any) -> None:
|
|
139
|
-
self._client.__exit__(*exc_details)
|
|
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 copy import deepcopy
|
|
10
|
+
from typing import Any, TYPE_CHECKING
|
|
11
|
+
from typing_extensions import Self
|
|
12
|
+
|
|
13
|
+
from azure.core import PipelineClient
|
|
14
|
+
from azure.core.pipeline import policies
|
|
15
|
+
from azure.core.rest import HttpRequest, HttpResponse
|
|
16
|
+
|
|
17
|
+
from ._configuration import AIProjectClientConfiguration
|
|
18
|
+
from ._utils.serialization import Deserializer, Serializer
|
|
19
|
+
from .operations import (
|
|
20
|
+
ConnectionsOperations,
|
|
21
|
+
DatasetsOperations,
|
|
22
|
+
DeploymentsOperations,
|
|
23
|
+
EvaluationResultsOperations,
|
|
24
|
+
EvaluationsOperations,
|
|
25
|
+
IndexesOperations,
|
|
26
|
+
RedTeamsOperations,
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
if TYPE_CHECKING:
|
|
30
|
+
from azure.core.credentials import TokenCredential
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class AIProjectClient: # pylint: disable=too-many-instance-attributes
|
|
34
|
+
"""AIProjectClient.
|
|
35
|
+
|
|
36
|
+
:ivar connections: ConnectionsOperations operations
|
|
37
|
+
:vartype connections: azure.ai.projects.onedp.operations.ConnectionsOperations
|
|
38
|
+
:ivar evaluations: EvaluationsOperations operations
|
|
39
|
+
:vartype evaluations: azure.ai.projects.onedp.operations.EvaluationsOperations
|
|
40
|
+
:ivar datasets: DatasetsOperations operations
|
|
41
|
+
:vartype datasets: azure.ai.projects.onedp.operations.DatasetsOperations
|
|
42
|
+
:ivar indexes: IndexesOperations operations
|
|
43
|
+
:vartype indexes: azure.ai.projects.onedp.operations.IndexesOperations
|
|
44
|
+
:ivar deployments: DeploymentsOperations operations
|
|
45
|
+
:vartype deployments: azure.ai.projects.onedp.operations.DeploymentsOperations
|
|
46
|
+
:ivar red_teams: RedTeamsOperations operations
|
|
47
|
+
:vartype red_teams: azure.ai.projects.onedp.operations.RedTeamsOperations
|
|
48
|
+
:ivar evaluation_results: EvaluationResultsOperations operations
|
|
49
|
+
:vartype evaluation_results: azure.ai.projects.onedp.operations.EvaluationResultsOperations
|
|
50
|
+
:param endpoint: Project endpoint. In the form
|
|
51
|
+
"https://<your-ai-services-account-name>.services.ai.azure.com/api/projects/_project"
|
|
52
|
+
if your Foundry Hub has only one Project, or to use the default Project in your Hub. Or in the
|
|
53
|
+
form
|
|
54
|
+
"https://<your-ai-services-account-name>.services.ai.azure.com/api/projects/<your-project-name>"
|
|
55
|
+
if you want to explicitly
|
|
56
|
+
specify the Foundry Project name. Required.
|
|
57
|
+
:type endpoint: str
|
|
58
|
+
:param credential: Credential used to authenticate requests to the service. Required.
|
|
59
|
+
:type credential: ~azure.core.credentials.TokenCredential
|
|
60
|
+
:keyword api_version: The API version to use for this operation. Default value is
|
|
61
|
+
"2025-05-15-preview". Note that overriding this default value may result in unsupported
|
|
62
|
+
behavior.
|
|
63
|
+
:paramtype api_version: str
|
|
64
|
+
"""
|
|
65
|
+
|
|
66
|
+
def __init__(self, endpoint: str, credential: "TokenCredential", **kwargs: Any) -> None:
|
|
67
|
+
_endpoint = "{endpoint}"
|
|
68
|
+
self._config = AIProjectClientConfiguration(endpoint=endpoint, credential=credential, **kwargs)
|
|
69
|
+
|
|
70
|
+
_policies = kwargs.pop("policies", None)
|
|
71
|
+
if _policies is None:
|
|
72
|
+
_policies = [
|
|
73
|
+
policies.RequestIdPolicy(**kwargs),
|
|
74
|
+
self._config.headers_policy,
|
|
75
|
+
self._config.user_agent_policy,
|
|
76
|
+
self._config.proxy_policy,
|
|
77
|
+
policies.ContentDecodePolicy(**kwargs),
|
|
78
|
+
self._config.redirect_policy,
|
|
79
|
+
self._config.retry_policy,
|
|
80
|
+
self._config.authentication_policy,
|
|
81
|
+
self._config.custom_hook_policy,
|
|
82
|
+
self._config.logging_policy,
|
|
83
|
+
policies.DistributedTracingPolicy(**kwargs),
|
|
84
|
+
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
|
|
85
|
+
self._config.http_logging_policy,
|
|
86
|
+
]
|
|
87
|
+
self._client: PipelineClient = PipelineClient(base_url=_endpoint, policies=_policies, **kwargs)
|
|
88
|
+
|
|
89
|
+
self._serialize = Serializer()
|
|
90
|
+
self._deserialize = Deserializer()
|
|
91
|
+
self._serialize.client_side_validation = False
|
|
92
|
+
self.connections = ConnectionsOperations(self._client, self._config, self._serialize, self._deserialize)
|
|
93
|
+
self.evaluations = EvaluationsOperations(self._client, self._config, self._serialize, self._deserialize)
|
|
94
|
+
self.datasets = DatasetsOperations(self._client, self._config, self._serialize, self._deserialize)
|
|
95
|
+
self.indexes = IndexesOperations(self._client, self._config, self._serialize, self._deserialize)
|
|
96
|
+
self.deployments = DeploymentsOperations(self._client, self._config, self._serialize, self._deserialize)
|
|
97
|
+
self.red_teams = RedTeamsOperations(self._client, self._config, self._serialize, self._deserialize)
|
|
98
|
+
self.evaluation_results = EvaluationResultsOperations(
|
|
99
|
+
self._client, self._config, self._serialize, self._deserialize
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
|
|
103
|
+
"""Runs the network request through the client's chained policies.
|
|
104
|
+
|
|
105
|
+
>>> from azure.core.rest import HttpRequest
|
|
106
|
+
>>> request = HttpRequest("GET", "https://www.example.org/")
|
|
107
|
+
<HttpRequest [GET], url: 'https://www.example.org/'>
|
|
108
|
+
>>> response = client.send_request(request)
|
|
109
|
+
<HttpResponse: 200 OK>
|
|
110
|
+
|
|
111
|
+
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
|
|
112
|
+
|
|
113
|
+
:param request: The network request you want to make. Required.
|
|
114
|
+
:type request: ~azure.core.rest.HttpRequest
|
|
115
|
+
:keyword bool stream: Whether the response payload will be streamed. Defaults to False.
|
|
116
|
+
:return: The response of your network call. Does not do error handling on your response.
|
|
117
|
+
:rtype: ~azure.core.rest.HttpResponse
|
|
118
|
+
"""
|
|
119
|
+
|
|
120
|
+
request_copy = deepcopy(request)
|
|
121
|
+
path_format_arguments = {
|
|
122
|
+
"endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True),
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments)
|
|
126
|
+
return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
|
|
127
|
+
|
|
128
|
+
def close(self) -> None:
|
|
129
|
+
self._client.close()
|
|
130
|
+
|
|
131
|
+
def __enter__(self) -> Self:
|
|
132
|
+
self._client.__enter__()
|
|
133
|
+
return self
|
|
134
|
+
|
|
135
|
+
def __exit__(self, *exc_details: Any) -> None:
|
|
136
|
+
self._client.__exit__(*exc_details)
|
|
@@ -1,73 +1,70 @@
|
|
|
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.
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
:
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
if
|
|
45
|
-
raise ValueError("Parameter '
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
self.
|
|
50
|
-
self.
|
|
51
|
-
|
|
52
|
-
self.
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
self.
|
|
64
|
-
self.
|
|
65
|
-
self.
|
|
66
|
-
self.
|
|
67
|
-
self.
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
self.authentication_policy = kwargs.get("authentication_policy")
|
|
72
|
-
if self.credential and not self.authentication_policy:
|
|
73
|
-
self.authentication_policy = self._infer_policy(**kwargs)
|
|
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 import TokenCredential
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class AIProjectClientConfiguration: # pylint: disable=too-many-instance-attributes
|
|
20
|
+
"""Configuration for AIProjectClient.
|
|
21
|
+
|
|
22
|
+
Note that all parameters used to create this instance are saved as instance
|
|
23
|
+
attributes.
|
|
24
|
+
|
|
25
|
+
:param endpoint: Project endpoint. In the form
|
|
26
|
+
"https://<your-ai-services-account-name>.services.ai.azure.com/api/projects/_project"
|
|
27
|
+
if your Foundry Hub has only one Project, or to use the default Project in your Hub. Or in the
|
|
28
|
+
form
|
|
29
|
+
"https://<your-ai-services-account-name>.services.ai.azure.com/api/projects/<your-project-name>"
|
|
30
|
+
if you want to explicitly
|
|
31
|
+
specify the Foundry Project name. Required.
|
|
32
|
+
:type endpoint: str
|
|
33
|
+
:param credential: Credential used to authenticate requests to the service. Required.
|
|
34
|
+
:type credential: ~azure.core.credentials.TokenCredential
|
|
35
|
+
:keyword api_version: The API version to use for this operation. Default value is
|
|
36
|
+
"2025-05-15-preview". Note that overriding this default value may result in unsupported
|
|
37
|
+
behavior.
|
|
38
|
+
:paramtype api_version: str
|
|
39
|
+
"""
|
|
40
|
+
|
|
41
|
+
def __init__(self, endpoint: str, credential: "TokenCredential", **kwargs: Any) -> None:
|
|
42
|
+
api_version: str = kwargs.pop("api_version", "2025-05-15-preview")
|
|
43
|
+
|
|
44
|
+
if endpoint is None:
|
|
45
|
+
raise ValueError("Parameter 'endpoint' must not be None.")
|
|
46
|
+
if credential is None:
|
|
47
|
+
raise ValueError("Parameter 'credential' must not be None.")
|
|
48
|
+
|
|
49
|
+
self.endpoint = endpoint
|
|
50
|
+
self.credential = credential
|
|
51
|
+
self.api_version = api_version
|
|
52
|
+
self.credential_scopes = kwargs.pop("credential_scopes", ["https://ai.azure.com/.default"])
|
|
53
|
+
kwargs.setdefault("sdk_moniker", "ai-projects-onedp/{}".format(VERSION))
|
|
54
|
+
self.polling_interval = kwargs.get("polling_interval", 30)
|
|
55
|
+
self._configure(**kwargs)
|
|
56
|
+
|
|
57
|
+
def _configure(self, **kwargs: Any) -> None:
|
|
58
|
+
self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs)
|
|
59
|
+
self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs)
|
|
60
|
+
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
|
|
61
|
+
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
|
|
62
|
+
self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs)
|
|
63
|
+
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
|
|
64
|
+
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
|
|
65
|
+
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
|
|
66
|
+
self.authentication_policy = kwargs.get("authentication_policy")
|
|
67
|
+
if self.credential and not self.authentication_policy:
|
|
68
|
+
self.authentication_policy = policies.BearerTokenCredentialPolicy(
|
|
69
|
+
self.credential, *self.credential_scopes, **kwargs
|
|
70
|
+
)
|
|
@@ -1,21 +1,21 @@
|
|
|
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
|
-
# --------------------------------------------------------------------------
|
|
6
|
-
"""Customize generated code here.
|
|
7
|
-
|
|
8
|
-
Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize
|
|
9
|
-
"""
|
|
10
|
-
from typing import List
|
|
11
|
-
|
|
12
|
-
__all__: List[str] = [] # Add all objects you want publicly available to users at this package level
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
def patch_sdk():
|
|
16
|
-
"""Do not remove from this file.
|
|
17
|
-
|
|
18
|
-
`patch_sdk` is a last resort escape hatch that allows you to do customizations
|
|
19
|
-
you can't accomplish using the techniques described in
|
|
20
|
-
https://aka.ms/azsdk/python/dpcodegen/python/customize
|
|
21
|
-
"""
|
|
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
|
+
# --------------------------------------------------------------------------
|
|
6
|
+
"""Customize generated code here.
|
|
7
|
+
|
|
8
|
+
Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize
|
|
9
|
+
"""
|
|
10
|
+
from typing import List
|
|
11
|
+
|
|
12
|
+
__all__: List[str] = [] # Add all objects you want publicly available to users at this package level
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def patch_sdk():
|
|
16
|
+
"""Do not remove from this file.
|
|
17
|
+
|
|
18
|
+
`patch_sdk` is a last resort escape hatch that allows you to do customizations
|
|
19
|
+
you can't accomplish using the techniques described in
|
|
20
|
+
https://aka.ms/azsdk/python/dpcodegen/python/customize
|
|
21
|
+
"""
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# --------------------------------------------------------------------------
|
|
2
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
# Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
|
+
# Code generated by Microsoft (R) Python Code Generator.
|
|
5
|
+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
6
|
+
# --------------------------------------------------------------------------
|