1
- # pylint: disable=line-too-long,useless-suppression
2
1
# coding=utf-8
3
2
# --------------------------------------------------------------------------
4
3
# Copyright (c) Microsoft Corporation. All rights reserved.
16
15
from azure .core .rest import HttpRequest , HttpResponse
17
16
18
17
from ._configuration import AIProjectClientConfiguration
19
- from ._serialization import Deserializer , Serializer
20
- from .operations import AgentsOperations , ConnectionsOperations , EvaluationsOperations , TelemetryOperations
18
+ from ._utils .serialization import Deserializer , Serializer
19
+ from .operations import (
20
+ ConnectionsOperations ,
21
+ DatasetsOperations ,
22
+ DeploymentsOperations ,
23
+ EvaluationsOperations ,
24
+ IndexesOperations ,
25
+ RedTeamsOperations ,
26
+ ServicePatternsOperations ,
27
+ )
21
28
22
29
if TYPE_CHECKING :
23
30
from azure .core .credentials import TokenCredential
24
31
25
32
26
- class AIProjectClient :
33
+ class AIProjectClient : # pylint: disable=too-many-instance-attributes
27
34
"""AIProjectClient.
28
35
29
- :ivar agents: AgentsOperations operations
30
- :vartype agents : azure.ai.projects.operations.AgentsOperations
36
+ :ivar service_patterns: ServicePatternsOperations operations
37
+ :vartype service_patterns : azure.ai.projects.operations.ServicePatternsOperations
31
38
:ivar connections: ConnectionsOperations operations
32
39
:vartype connections: azure.ai.projects.operations.ConnectionsOperations
33
- :ivar telemetry: TelemetryOperations operations
34
- :vartype telemetry: azure.ai.projects.operations.TelemetryOperations
35
40
:ivar evaluations: EvaluationsOperations operations
36
41
:vartype evaluations: azure.ai.projects.operations.EvaluationsOperations
37
- :param endpoint: The Azure AI Foundry project endpoint, in the form
38
- ``https://<azure-region>.api.azureml.ms`` or
39
- ``https://<private-link-guid>.<azure-region>.api.azureml.ms``, where <azure-region> is the
40
- Azure region where the project is deployed (e.g. westus) and <private-link-guid> is the GUID of
41
- the Enterprise private link. Required.
42
+ :ivar datasets: DatasetsOperations operations
43
+ :vartype datasets: azure.ai.projects.operations.DatasetsOperations
44
+ :ivar indexes: IndexesOperations operations
45
+ :vartype indexes: azure.ai.projects.operations.IndexesOperations
46
+ :ivar deployments: DeploymentsOperations operations
47
+ :vartype deployments: azure.ai.projects.operations.DeploymentsOperations
48
+ :ivar red_teams: RedTeamsOperations operations
49
+ :vartype red_teams: azure.ai.projects.operations.RedTeamsOperations
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.
42
57
:type endpoint: str
43
- :param subscription_id: The Azure subscription ID. Required.
44
- :type subscription_id: str
45
- :param resource_group_name: The name of the Azure Resource Group. Required.
46
- :type resource_group_name: str
47
- :param project_name: The Azure AI Foundry project name. Required.
48
- :type project_name: str
49
58
:param credential: Credential used to authenticate requests to the service. Required.
50
59
:type credential: ~azure.core.credentials.TokenCredential
51
60
:keyword api_version: The API version to use for this operation. Default value is
52
- "2024-07-01 -preview". Note that overriding this default value may result in unsupported
61
+ "2025-05-15 -preview". Note that overriding this default value may result in unsupported
53
62
behavior.
54
63
:paramtype api_version: str
55
64
"""
56
65
57
- def __init__ (
58
- self ,
59
- endpoint : str ,
60
- subscription_id : str ,
61
- resource_group_name : str ,
62
- project_name : str ,
63
- credential : "TokenCredential" ,
64
- ** kwargs : Any
65
- ) -> None :
66
- _endpoint = "{endpoint}/agents/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{projectName}"
67
- self ._config = AIProjectClientConfiguration (
68
- endpoint = endpoint ,
69
- subscription_id = subscription_id ,
70
- resource_group_name = resource_group_name ,
71
- project_name = project_name ,
72
- credential = credential ,
73
- ** kwargs
74
- )
66
+ def __init__ (self , endpoint : str , credential : "TokenCredential" , ** kwargs : Any ) -> None :
67
+ _endpoint = "{endpoint}"
68
+ self ._config = AIProjectClientConfiguration (endpoint = endpoint , credential = credential , ** kwargs )
69
+
75
70
_policies = kwargs .pop ("policies" , None )
76
71
if _policies is None :
77
72
_policies = [
@@ -94,10 +89,15 @@ def __init__(
94
89
self ._serialize = Serializer ()
95
90
self ._deserialize = Deserializer ()
96
91
self ._serialize .client_side_validation = False
97
- self .agents = AgentsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
92
+ self .service_patterns = ServicePatternsOperations (
93
+ self ._client , self ._config , self ._serialize , self ._deserialize
94
+ )
98
95
self .connections = ConnectionsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
99
- self .telemetry = TelemetryOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
100
96
self .evaluations = EvaluationsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
97
+ self .datasets = DatasetsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
98
+ self .indexes = IndexesOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
99
+ self .deployments = DeploymentsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
100
+ self .red_teams = RedTeamsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
101
101
102
102
def send_request (self , request : HttpRequest , * , stream : bool = False , ** kwargs : Any ) -> HttpResponse :
103
103
"""Runs the network request through the client's chained policies.
@@ -119,12 +119,7 @@ def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs:
119
119
120
120
request_copy = deepcopy (request )
121
121
path_format_arguments = {
122
- "endpoint" : self ._serialize .url ("self._config.endpoint" , self ._config .endpoint , "str" ),
123
- "subscriptionId" : self ._serialize .url ("self._config.subscription_id" , self ._config .subscription_id , "str" ),
124
- "resourceGroupName" : self ._serialize .url (
125
- "self._config.resource_group_name" , self ._config .resource_group_name , "str"
126
- ),
127
- "projectName" : self ._serialize .url ("self._config.project_name" , self ._config .project_name , "str" ),
122
+ "endpoint" : self ._serialize .url ("self._config.endpoint" , self ._config .endpoint , "str" , skip_quote = True ),
128
123
}
129
124
130
125
request_copy .url = self ._client .format_url (request_copy .url , ** path_format_arguments )
0 commit comments