Skip to content

Commit e5fc680

Browse files
author
SDKAuto
committed
CodeGen from PR 34383 in Azure/azure-rest-api-specs
Merge d1a69e0d10c539bc9a5d8144ecb68bc0c654c7d2 into 9f83acd412aa185254294752506dfcf88d401dfd
1 parent 8e61a00 commit e5fc680

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+5083
-32581
lines changed

sdk/ai/azure-ai-projects/_meta.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"commit": "0ce20699cdb2f8e823a339039643379ff288baee",
3+
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
4+
"typespec_src": "specification/ai/Azure.AI.Projects",
5+
"@azure-tools/typespec-python": "0.44.1"
6+
}

sdk/ai/azure-ai-projects/apiview-properties.json

Lines changed: 84 additions & 266 deletions
Large diffs are not rendered by default.

sdk/ai/azure-ai-projects/azure/ai/projects/_client.py

Lines changed: 41 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# pylint: disable=line-too-long,useless-suppression
21
# coding=utf-8
32
# --------------------------------------------------------------------------
43
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -16,62 +15,58 @@
1615
from azure.core.rest import HttpRequest, HttpResponse
1716

1817
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+
)
2128

2229
if 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)

sdk/ai/azure-ai-projects/azure/ai/projects/_configuration.py

Lines changed: 11 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -22,55 +22,34 @@ class AIProjectClientConfiguration: # pylint: disable=too-many-instance-attribu
2222
Note that all parameters used to create this instance are saved as instance
2323
attributes.
2424
25-
:param endpoint: The Azure AI Foundry project endpoint, in the form
26-
``https://<azure-region>.api.azureml.ms`` or
27-
``https://<private-link-guid>.<azure-region>.api.azureml.ms``, where <azure-region> is the
28-
Azure region where the project is deployed (e.g. westus) and <private-link-guid> is the GUID of
29-
the Enterprise private link. Required.
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.
3032
:type endpoint: str
31-
:param subscription_id: The Azure subscription ID. Required.
32-
:type subscription_id: str
33-
:param resource_group_name: The name of the Azure Resource Group. Required.
34-
:type resource_group_name: str
35-
:param project_name: The Azure AI Foundry project name. Required.
36-
:type project_name: str
3733
:param credential: Credential used to authenticate requests to the service. Required.
3834
:type credential: ~azure.core.credentials.TokenCredential
3935
:keyword api_version: The API version to use for this operation. Default value is
40-
"2024-07-01-preview". Note that overriding this default value may result in unsupported
36+
"2025-05-15-preview". Note that overriding this default value may result in unsupported
4137
behavior.
4238
:paramtype api_version: str
4339
"""
4440

45-
def __init__(
46-
self,
47-
endpoint: str,
48-
subscription_id: str,
49-
resource_group_name: str,
50-
project_name: str,
51-
credential: "TokenCredential",
52-
**kwargs: Any
53-
) -> None:
54-
api_version: str = kwargs.pop("api_version", "2024-07-01-preview")
41+
def __init__(self, endpoint: str, credential: "TokenCredential", **kwargs: Any) -> None:
42+
api_version: str = kwargs.pop("api_version", "2025-05-15-preview")
5543

5644
if endpoint is None:
5745
raise ValueError("Parameter 'endpoint' must not be None.")
58-
if subscription_id is None:
59-
raise ValueError("Parameter 'subscription_id' must not be None.")
60-
if resource_group_name is None:
61-
raise ValueError("Parameter 'resource_group_name' must not be None.")
62-
if project_name is None:
63-
raise ValueError("Parameter 'project_name' must not be None.")
6446
if credential is None:
6547
raise ValueError("Parameter 'credential' must not be None.")
6648

6749
self.endpoint = endpoint
68-
self.subscription_id = subscription_id
69-
self.resource_group_name = resource_group_name
70-
self.project_name = project_name
7150
self.credential = credential
7251
self.api_version = api_version
73-
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
52+
self.credential_scopes = kwargs.pop("credential_scopes", ["https://cognitiveservices.azure.com/.default"])
7453
kwargs.setdefault("sdk_moniker", "ai-projects/{}".format(VERSION))
7554
self.polling_interval = kwargs.get("polling_interval", 30)
7655
self._configure(**kwargs)

0 commit comments

Comments
 (0)