Skip to content

Commit 5b8cf1b

Browse files
author
SDKAuto
committed
CodeGen from PR 33797 in Azure/azure-rest-api-specs
Merge c65860f5e009e7a23ecb0d34075e646733629c92 into 702b83581350953f0ab6708cbf29a1357269afc3
1 parent eae4b41 commit 5b8cf1b

File tree

58 files changed

+908
-7236
lines changed

Some content is hidden

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

58 files changed

+908
-7236
lines changed

sdk/ai/azure-ai-inference/MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ include azure/ai/inference/py.typed
44
recursive-include tests *.py
55
recursive-include samples *.py *.md
66
include azure/__init__.py
7-
include azure/ai/__init__.py
7+
include azure/ai/__init__.py
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"commit": "caee61180367b726db470989a36ee57837825a37",
3+
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
4+
"typespec_src": "specification/ai/ModelClient",
5+
"@azure-tools/typespec-python": "0.42.2"
6+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
"CrossLanguagePackageId": "Azure.AI.Inference",
3+
"CrossLanguageDefinitionId": {
4+
"azure.ai.inference.models.ContentItem": "Azure.AI.Inference.ChatMessageContentItem",
5+
"azure.ai.inference.models.AudioDataContentItem": "Azure.AI.Inference.ChatMessageAudioDataContentItem",
6+
"azure.ai.inference.models.AudioUrlContentItem": "Azure.AI.Inference.ChatMessageAudioUrlContentItem",
7+
"azure.ai.inference.models.ChatChoice": "Azure.AI.Inference.ChatChoice",
8+
"azure.ai.inference.models.ChatCompletions": "Azure.AI.Inference.ChatCompletions",
9+
"azure.ai.inference.models.ChatCompletionsNamedToolChoice": "Azure.AI.Inference.ChatCompletionsNamedToolChoice",
10+
"azure.ai.inference.models.ChatCompletionsNamedToolChoiceFunction": "Azure.AI.Inference.ChatCompletionsNamedToolChoiceFunction",
11+
"azure.ai.inference.models.ChatCompletionsToolCall": "Azure.AI.Inference.ChatCompletionsToolCall",
12+
"azure.ai.inference.models.ChatCompletionsToolDefinition": "Azure.AI.Inference.ChatCompletionsToolDefinition",
13+
"azure.ai.inference.models.ChatResponseMessage": "Azure.AI.Inference.ChatResponseMessage",
14+
"azure.ai.inference.models.CompletionsUsage": "Azure.AI.Inference.CompletionsUsage",
15+
"azure.ai.inference.models.CompletionsUsageDetails": "Azure.AI.Inference.CompletionsUsageDetails",
16+
"azure.ai.inference.models.EmbeddingItem": "Azure.AI.Inference.EmbeddingItem",
17+
"azure.ai.inference.models.EmbeddingsResult": "Azure.AI.Inference.EmbeddingsResult",
18+
"azure.ai.inference.models.EmbeddingsUsage": "Azure.AI.Inference.EmbeddingsUsage",
19+
"azure.ai.inference.models.FunctionCall": "Azure.AI.Inference.FunctionCall",
20+
"azure.ai.inference.models.FunctionDefinition": "Azure.AI.Inference.FunctionDefinition",
21+
"azure.ai.inference.models.ImageContentItem": "Azure.AI.Inference.ChatMessageImageContentItem",
22+
"azure.ai.inference.models.ImageEmbeddingInput": "Azure.AI.Inference.ImageEmbeddingInput",
23+
"azure.ai.inference.models.ImageUrl": "Azure.AI.Inference.ChatMessageImageUrl",
24+
"azure.ai.inference.models.InputAudio": "Azure.AI.Inference.ChatMessageInputAudio",
25+
"azure.ai.inference.models.InputAudioUrl": "Azure.AI.Inference.ChatMessageInputAudioUrl",
26+
"azure.ai.inference.models.JsonSchemaFormat": "Azure.AI.Inference.ChatCompletionsResponseFormatJsonSchemaDefinition",
27+
"azure.ai.inference.models.ModelInfo": "Azure.AI.Inference.ModelInfo",
28+
"azure.ai.inference.models.PromptUsageDetails": "Azure.AI.Inference.PromptUsageDetails",
29+
"azure.ai.inference.models.StreamingChatChoiceUpdate": "Azure.AI.Inference.StreamingChatChoiceUpdate",
30+
"azure.ai.inference.models.StreamingChatCompletionsUpdate": "Azure.AI.Inference.StreamingChatCompletionsUpdate",
31+
"azure.ai.inference.models.StreamingChatResponseMessageUpdate": "Azure.AI.Inference.StreamingChatResponseMessageUpdate",
32+
"azure.ai.inference.models.StreamingChatResponseToolCallUpdate": "Azure.AI.Inference.StreamingChatResponseToolCallUpdate",
33+
"azure.ai.inference.models.TextContentItem": "Azure.AI.Inference.ChatMessageTextContentItem",
34+
"azure.ai.inference.models.CompletionsFinishReason": "Azure.AI.Inference.CompletionsFinishReason",
35+
"azure.ai.inference.models.ChatRole": "Azure.AI.Inference.ChatRole",
36+
"azure.ai.inference.models.ImageDetailLevel": "Azure.AI.Inference.ChatMessageImageDetailLevel",
37+
"azure.ai.inference.models.AudioContentFormat": "Azure.AI.Inference.AudioContentFormat",
38+
"azure.ai.inference.models.ChatCompletionsToolChoicePreset": "Azure.AI.Inference.ChatCompletionsToolChoicePreset",
39+
"azure.ai.inference.models.ModelType": "Azure.AI.Inference.ModelType",
40+
"azure.ai.inference.models.EmbeddingEncodingFormat": "Azure.AI.Inference.EmbeddingEncodingFormat",
41+
"azure.ai.inference.models.EmbeddingInputType": "Azure.AI.Inference.EmbeddingInputType"
42+
}
43+
}

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

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,9 @@ class ChatCompletionsClient(ChatCompletionsClientOperationsMixin):
3939
:param credential: Credential used to authenticate requests to the service. Is either a key
4040
credential type or a token credential type. Required.
4141
:type credential: ~azure.core.credentials.AzureKeyCredential or
42-
~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials.TokenCredential
43-
:keyword api_version: The API version to use for this operation. Default value is
44-
"2024-05-01-preview". Note that overriding this default value may result in unsupported
45-
behavior.
42+
~azure.core.credentials.TokenCredential
43+
:keyword api_version: The API version to use for this operation. Default value is "2025-04-01".
44+
Note that overriding this default value may result in unsupported behavior.
4645
:paramtype api_version: str
4746
"""
4847

@@ -117,10 +116,9 @@ class EmbeddingsClient(EmbeddingsClientOperationsMixin):
117116
:param credential: Credential used to authenticate requests to the service. Is either a key
118117
credential type or a token credential type. Required.
119118
:type credential: ~azure.core.credentials.AzureKeyCredential or
120-
~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials.TokenCredential
121-
:keyword api_version: The API version to use for this operation. Default value is
122-
"2024-05-01-preview". Note that overriding this default value may result in unsupported
123-
behavior.
119+
~azure.core.credentials.TokenCredential
120+
:keyword api_version: The API version to use for this operation. Default value is "2025-04-01".
121+
Note that overriding this default value may result in unsupported behavior.
124122
:paramtype api_version: str
125123
"""
126124

@@ -195,10 +193,9 @@ class ImageEmbeddingsClient(ImageEmbeddingsClientOperationsMixin):
195193
:param credential: Credential used to authenticate requests to the service. Is either a key
196194
credential type or a token credential type. Required.
197195
:type credential: ~azure.core.credentials.AzureKeyCredential or
198-
~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials.TokenCredential
199-
:keyword api_version: The API version to use for this operation. Default value is
200-
"2024-05-01-preview". Note that overriding this default value may result in unsupported
201-
behavior.
196+
~azure.core.credentials.TokenCredential
197+
:keyword api_version: The API version to use for this operation. Default value is "2025-04-01".
198+
Note that overriding this default value may result in unsupported behavior.
202199
:paramtype api_version: str
203200
"""
204201

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

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,14 @@ class ChatCompletionsClientConfiguration: # pylint: disable=too-many-instance-a
2828
:param credential: Credential used to authenticate requests to the service. Is either a key
2929
credential type or a token credential type. Required.
3030
:type credential: ~azure.core.credentials.AzureKeyCredential or
31-
~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials.TokenCredential
32-
:keyword api_version: The API version to use for this operation. Default value is
33-
"2024-05-01-preview". Note that overriding this default value may result in unsupported
34-
behavior.
31+
~azure.core.credentials.TokenCredential
32+
:keyword api_version: The API version to use for this operation. Default value is "2025-04-01".
33+
Note that overriding this default value may result in unsupported behavior.
3534
:paramtype api_version: str
3635
"""
3736

3837
def __init__(self, endpoint: str, credential: Union[AzureKeyCredential, "TokenCredential"], **kwargs: Any) -> None:
39-
api_version: str = kwargs.pop("api_version", "2024-05-01-preview")
38+
api_version: str = kwargs.pop("api_version", "2025-04-01")
4039

4140
if endpoint is None:
4241
raise ValueError("Parameter 'endpoint' must not be None.")
@@ -46,16 +45,14 @@ def __init__(self, endpoint: str, credential: Union[AzureKeyCredential, "TokenCr
4645
self.endpoint = endpoint
4746
self.credential = credential
4847
self.api_version = api_version
49-
self.credential_scopes = kwargs.pop("credential_scopes", ["https://ml.azure.com/.default"])
48+
self.credential_scopes = kwargs.pop("credential_scopes", ["https://cognitiveservices.azure.com/.default"])
5049
kwargs.setdefault("sdk_moniker", "ai-inference/{}".format(VERSION))
5150
self.polling_interval = kwargs.get("polling_interval", 30)
5251
self._configure(**kwargs)
5352

5453
def _infer_policy(self, **kwargs):
5554
if isinstance(self.credential, AzureKeyCredential):
5655
return policies.AzureKeyCredentialPolicy(self.credential, "Authorization", prefix="Bearer", **kwargs)
57-
if isinstance(self.credential, AzureKeyCredential):
58-
return policies.AzureKeyCredentialPolicy(self.credential, "api-key", **kwargs)
5956
if hasattr(self.credential, "get_token"):
6057
return policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
6158
raise TypeError(f"Unsupported credential: {self.credential}")
@@ -85,15 +82,14 @@ class EmbeddingsClientConfiguration: # pylint: disable=too-many-instance-attrib
8582
:param credential: Credential used to authenticate requests to the service. Is either a key
8683
credential type or a token credential type. Required.
8784
:type credential: ~azure.core.credentials.AzureKeyCredential or
88-
~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials.TokenCredential
89-
:keyword api_version: The API version to use for this operation. Default value is
90-
"2024-05-01-preview". Note that overriding this default value may result in unsupported
91-
behavior.
85+
~azure.core.credentials.TokenCredential
86+
:keyword api_version: The API version to use for this operation. Default value is "2025-04-01".
87+
Note that overriding this default value may result in unsupported behavior.
9288
:paramtype api_version: str
9389
"""
9490

9591
def __init__(self, endpoint: str, credential: Union[AzureKeyCredential, "TokenCredential"], **kwargs: Any) -> None:
96-
api_version: str = kwargs.pop("api_version", "2024-05-01-preview")
92+
api_version: str = kwargs.pop("api_version", "2025-04-01")
9793

9894
if endpoint is None:
9995
raise ValueError("Parameter 'endpoint' must not be None.")
@@ -103,16 +99,14 @@ def __init__(self, endpoint: str, credential: Union[AzureKeyCredential, "TokenCr
10399
self.endpoint = endpoint
104100
self.credential = credential
105101
self.api_version = api_version
106-
self.credential_scopes = kwargs.pop("credential_scopes", ["https://ml.azure.com/.default"])
102+
self.credential_scopes = kwargs.pop("credential_scopes", ["https://cognitiveservices.azure.com/.default"])
107103
kwargs.setdefault("sdk_moniker", "ai-inference/{}".format(VERSION))
108104
self.polling_interval = kwargs.get("polling_interval", 30)
109105
self._configure(**kwargs)
110106

111107
def _infer_policy(self, **kwargs):
112108
if isinstance(self.credential, AzureKeyCredential):
113109
return policies.AzureKeyCredentialPolicy(self.credential, "Authorization", prefix="Bearer", **kwargs)
114-
if isinstance(self.credential, AzureKeyCredential):
115-
return policies.AzureKeyCredentialPolicy(self.credential, "api-key", **kwargs)
116110
if hasattr(self.credential, "get_token"):
117111
return policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
118112
raise TypeError(f"Unsupported credential: {self.credential}")
@@ -142,15 +136,14 @@ class ImageEmbeddingsClientConfiguration: # pylint: disable=too-many-instance-a
142136
:param credential: Credential used to authenticate requests to the service. Is either a key
143137
credential type or a token credential type. Required.
144138
:type credential: ~azure.core.credentials.AzureKeyCredential or
145-
~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials.TokenCredential
146-
:keyword api_version: The API version to use for this operation. Default value is
147-
"2024-05-01-preview". Note that overriding this default value may result in unsupported
148-
behavior.
139+
~azure.core.credentials.TokenCredential
140+
:keyword api_version: The API version to use for this operation. Default value is "2025-04-01".
141+
Note that overriding this default value may result in unsupported behavior.
149142
:paramtype api_version: str
150143
"""
151144

152145
def __init__(self, endpoint: str, credential: Union[AzureKeyCredential, "TokenCredential"], **kwargs: Any) -> None:
153-
api_version: str = kwargs.pop("api_version", "2024-05-01-preview")
146+
api_version: str = kwargs.pop("api_version", "2025-04-01")
154147

155148
if endpoint is None:
156149
raise ValueError("Parameter 'endpoint' must not be None.")
@@ -160,16 +153,14 @@ def __init__(self, endpoint: str, credential: Union[AzureKeyCredential, "TokenCr
160153
self.endpoint = endpoint
161154
self.credential = credential
162155
self.api_version = api_version
163-
self.credential_scopes = kwargs.pop("credential_scopes", ["https://ml.azure.com/.default"])
156+
self.credential_scopes = kwargs.pop("credential_scopes", ["https://cognitiveservices.azure.com/.default"])
164157
kwargs.setdefault("sdk_moniker", "ai-inference/{}".format(VERSION))
165158
self.polling_interval = kwargs.get("polling_interval", 30)
166159
self._configure(**kwargs)
167160

168161
def _infer_policy(self, **kwargs):
169162
if isinstance(self.credential, AzureKeyCredential):
170163
return policies.AzureKeyCredentialPolicy(self.credential, "Authorization", prefix="Bearer", **kwargs)
171-
if isinstance(self.credential, AzureKeyCredential):
172-
return policies.AzureKeyCredentialPolicy(self.credential, "api-key", **kwargs)
173164
if hasattr(self.credential, "get_token"):
174165
return policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
175166
raise TypeError(f"Unsupported credential: {self.credential}")

sdk/ai/azure-ai-inference/azure/ai/inference/_model_base.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
# pylint: disable=too-many-lines,arguments-differ,signature-differs,no-member
1+
# pylint: disable=too-many-lines
22
# coding=utf-8
33
# --------------------------------------------------------------------------
44
# Copyright (c) Microsoft Corporation. All rights reserved.
5-
# Licensed under the MIT License. See License.txt in the project root for
6-
# license information.
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.
78
# --------------------------------------------------------------------------
89
# pylint: disable=protected-access, broad-except
910

0 commit comments

Comments
 (0)