1- # pylint: disable=line-too-long,useless-suppression
21# coding=utf-8
32# --------------------------------------------------------------------------
43# Copyright (c) Microsoft Corporation. All rights reserved.
1615from azure .core .rest import HttpRequest , HttpResponse
1716
1817from ._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+ )
2128
2229if TYPE_CHECKING :
2330 from azure .core .credentials import TokenCredential
2431
2532
26- class AIProjectClient :
33+ class AIProjectClient : # pylint: disable=too-many-instance-attributes
2734 """AIProjectClient.
2835
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
3138 :ivar connections: ConnectionsOperations operations
3239 :vartype connections: azure.ai.projects.operations.ConnectionsOperations
33- :ivar telemetry: TelemetryOperations operations
34- :vartype telemetry: azure.ai.projects.operations.TelemetryOperations
3540 :ivar evaluations: EvaluationsOperations operations
3641 :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.
4257 :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
4958 :param credential: Credential used to authenticate requests to the service. Required.
5059 :type credential: ~azure.core.credentials.TokenCredential
5160 :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
5362 behavior.
5463 :paramtype api_version: str
5564 """
5665
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+
7570 _policies = kwargs .pop ("policies" , None )
7671 if _policies is None :
7772 _policies = [
@@ -94,10 +89,15 @@ def __init__(
9489 self ._serialize = Serializer ()
9590 self ._deserialize = Deserializer ()
9691 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+ )
9895 self .connections = ConnectionsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
99- self .telemetry = TelemetryOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
10096 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 )
101101
102102 def send_request (self , request : HttpRequest , * , stream : bool = False , ** kwargs : Any ) -> HttpResponse :
103103 """Runs the network request through the client's chained policies.
@@ -119,12 +119,7 @@ def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs:
119119
120120 request_copy = deepcopy (request )
121121 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 ),
128123 }
129124
130125 request_copy .url = self ._client .format_url (request_copy .url , ** path_format_arguments )
0 commit comments