Skip to content

Commit 99b0548

Browse files
author
SDKAuto
committed
CodeGen from PR 31117 in Azure/azure-rest-api-specs
Merge 77b8dceea9dc9b958323f34cbbc12e741d93d95d into 3a168488bc291f47ffa14d0fff10cabc2cf5ea37
1 parent f77bd94 commit 99b0548

40 files changed

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

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

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,32 @@
55
# Code generated by Microsoft (R) Python Code Generator.
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
8+
# pylint: disable=wrong-import-position
89

9-
from ._patch import ChatCompletionsClient
10-
from ._patch import EmbeddingsClient
11-
from ._patch import ImageEmbeddingsClient
10+
from typing import TYPE_CHECKING
11+
12+
if TYPE_CHECKING:
13+
from ._patch import * # pylint: disable=unused-wildcard-import
14+
15+
from ._client import ChatCompletionsClient # type: ignore
16+
from ._client import EmbeddingsClient # type: ignore
17+
from ._client import ImageEmbeddingsClient # type: ignore
1218
from ._version import VERSION
1319

1420
__version__ = VERSION
1521

16-
17-
from ._patch import load_client
22+
try:
23+
from ._patch import __all__ as _patch_all
24+
from ._patch import *
25+
except ImportError:
26+
_patch_all = []
1827
from ._patch import patch_sdk as _patch_sdk
1928

2029
__all__ = [
21-
"load_client",
2230
"ChatCompletionsClient",
2331
"EmbeddingsClient",
2432
"ImageEmbeddingsClient",
2533
]
26-
34+
__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
2735

2836
_patch_sdk()

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

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,18 @@
2828
from ._serialization import Deserializer, Serializer
2929

3030
if TYPE_CHECKING:
31-
# pylint: disable=unused-import,ungrouped-imports
3231
from azure.core.credentials import TokenCredential
3332

3433

35-
class ChatCompletionsClient(ChatCompletionsClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword
34+
class ChatCompletionsClient(ChatCompletionsClientOperationsMixin):
3635
"""ChatCompletionsClient.
3736
3837
:param endpoint: Service host. Required.
3938
:type endpoint: str
40-
:param credential: Credential used to authenticate requests to the service. Is one of the
41-
following types: AzureKeyCredential, AzureKeyCredential, TokenCredential Required.
39+
:param credential: Credential used to authenticate requests to the service. Is either a
40+
AzureKeyCredential type or a TokenCredential type. Required.
4241
:type credential: ~azure.core.credentials.AzureKeyCredential or
43-
~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials.TokenCredential
42+
~azure.core.credentials.TokenCredential
4443
:keyword api_version: The API version to use for this operation. Default value is
4544
"2024-05-01-preview". Note that overriding this default value may result in unsupported
4645
behavior.
@@ -110,15 +109,15 @@ def __exit__(self, *exc_details: Any) -> None:
110109
self._client.__exit__(*exc_details)
111110

112111

113-
class EmbeddingsClient(EmbeddingsClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword
112+
class EmbeddingsClient(EmbeddingsClientOperationsMixin):
114113
"""EmbeddingsClient.
115114
116115
:param endpoint: Service host. Required.
117116
:type endpoint: str
118-
:param credential: Credential used to authenticate requests to the service. Is one of the
119-
following types: AzureKeyCredential, AzureKeyCredential, TokenCredential Required.
117+
:param credential: Credential used to authenticate requests to the service. Is either a
118+
AzureKeyCredential type or a TokenCredential type. Required.
120119
:type credential: ~azure.core.credentials.AzureKeyCredential or
121-
~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials.TokenCredential
120+
~azure.core.credentials.TokenCredential
122121
:keyword api_version: The API version to use for this operation. Default value is
123122
"2024-05-01-preview". Note that overriding this default value may result in unsupported
124123
behavior.
@@ -188,15 +187,15 @@ def __exit__(self, *exc_details: Any) -> None:
188187
self._client.__exit__(*exc_details)
189188

190189

191-
class ImageEmbeddingsClient(ImageEmbeddingsClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword
190+
class ImageEmbeddingsClient(ImageEmbeddingsClientOperationsMixin):
192191
"""ImageEmbeddingsClient.
193192
194193
:param endpoint: Service host. Required.
195194
:type endpoint: str
196-
:param credential: Credential used to authenticate requests to the service. Is one of the
197-
following types: AzureKeyCredential, AzureKeyCredential, TokenCredential Required.
195+
:param credential: Credential used to authenticate requests to the service. Is either a
196+
AzureKeyCredential type or a TokenCredential type. Required.
198197
:type credential: ~azure.core.credentials.AzureKeyCredential or
199-
~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials.TokenCredential
198+
~azure.core.credentials.TokenCredential
200199
:keyword api_version: The API version to use for this operation. Default value is
201200
"2024-05-01-preview". Note that overriding this default value may result in unsupported
202201
behavior.

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

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,21 @@
1414
from ._version import VERSION
1515

1616
if TYPE_CHECKING:
17-
# pylint: disable=unused-import,ungrouped-imports
1817
from azure.core.credentials import TokenCredential
1918

2019

21-
class ChatCompletionsClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
20+
class ChatCompletionsClientConfiguration: # pylint: disable=too-many-instance-attributes
2221
"""Configuration for ChatCompletionsClient.
2322
2423
Note that all parameters used to create this instance are saved as instance
2524
attributes.
2625
2726
:param endpoint: Service host. Required.
2827
:type endpoint: str
29-
:param credential: Credential used to authenticate requests to the service. Is one of the
30-
following types: AzureKeyCredential, AzureKeyCredential, TokenCredential Required.
28+
:param credential: Credential used to authenticate requests to the service. Is either a
29+
AzureKeyCredential type or a TokenCredential type. Required.
3130
:type credential: ~azure.core.credentials.AzureKeyCredential or
32-
~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials.TokenCredential
31+
~azure.core.credentials.TokenCredential
3332
:keyword api_version: The API version to use for this operation. Default value is
3433
"2024-05-01-preview". Note that overriding this default value may result in unsupported
3534
behavior.
@@ -55,8 +54,6 @@ def __init__(self, endpoint: str, credential: Union[AzureKeyCredential, "TokenCr
5554
def _infer_policy(self, **kwargs):
5655
if isinstance(self.credential, AzureKeyCredential):
5756
return policies.AzureKeyCredentialPolicy(self.credential, "Authorization", prefix="Bearer", **kwargs)
58-
if isinstance(self.credential, AzureKeyCredential):
59-
return policies.AzureKeyCredentialPolicy(self.credential, "api-key", **kwargs)
6057
if hasattr(self.credential, "get_token"):
6158
return policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
6259
raise TypeError(f"Unsupported credential: {self.credential}")
@@ -75,18 +72,18 @@ def _configure(self, **kwargs: Any) -> None:
7572
self.authentication_policy = self._infer_policy(**kwargs)
7673

7774

78-
class EmbeddingsClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
75+
class EmbeddingsClientConfiguration: # pylint: disable=too-many-instance-attributes
7976
"""Configuration for EmbeddingsClient.
8077
8178
Note that all parameters used to create this instance are saved as instance
8279
attributes.
8380
8481
:param endpoint: Service host. Required.
8582
:type endpoint: str
86-
:param credential: Credential used to authenticate requests to the service. Is one of the
87-
following types: AzureKeyCredential, AzureKeyCredential, TokenCredential Required.
83+
:param credential: Credential used to authenticate requests to the service. Is either a
84+
AzureKeyCredential type or a TokenCredential type. Required.
8885
:type credential: ~azure.core.credentials.AzureKeyCredential or
89-
~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials.TokenCredential
86+
~azure.core.credentials.TokenCredential
9087
:keyword api_version: The API version to use for this operation. Default value is
9188
"2024-05-01-preview". Note that overriding this default value may result in unsupported
9289
behavior.
@@ -112,8 +109,6 @@ def __init__(self, endpoint: str, credential: Union[AzureKeyCredential, "TokenCr
112109
def _infer_policy(self, **kwargs):
113110
if isinstance(self.credential, AzureKeyCredential):
114111
return policies.AzureKeyCredentialPolicy(self.credential, "Authorization", prefix="Bearer", **kwargs)
115-
if isinstance(self.credential, AzureKeyCredential):
116-
return policies.AzureKeyCredentialPolicy(self.credential, "api-key", **kwargs)
117112
if hasattr(self.credential, "get_token"):
118113
return policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
119114
raise TypeError(f"Unsupported credential: {self.credential}")
@@ -132,18 +127,18 @@ def _configure(self, **kwargs: Any) -> None:
132127
self.authentication_policy = self._infer_policy(**kwargs)
133128

134129

135-
class ImageEmbeddingsClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
130+
class ImageEmbeddingsClientConfiguration: # pylint: disable=too-many-instance-attributes
136131
"""Configuration for ImageEmbeddingsClient.
137132
138133
Note that all parameters used to create this instance are saved as instance
139134
attributes.
140135
141136
:param endpoint: Service host. Required.
142137
:type endpoint: str
143-
:param credential: Credential used to authenticate requests to the service. Is one of the
144-
following types: AzureKeyCredential, AzureKeyCredential, TokenCredential Required.
138+
:param credential: Credential used to authenticate requests to the service. Is either a
139+
AzureKeyCredential type or a TokenCredential type. Required.
145140
:type credential: ~azure.core.credentials.AzureKeyCredential or
146-
~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials.TokenCredential
141+
~azure.core.credentials.TokenCredential
147142
:keyword api_version: The API version to use for this operation. Default value is
148143
"2024-05-01-preview". Note that overriding this default value may result in unsupported
149144
behavior.
@@ -169,8 +164,6 @@ def __init__(self, endpoint: str, credential: Union[AzureKeyCredential, "TokenCr
169164
def _infer_policy(self, **kwargs):
170165
if isinstance(self.credential, AzureKeyCredential):
171166
return policies.AzureKeyCredentialPolicy(self.credential, "Authorization", prefix="Bearer", **kwargs)
172-
if isinstance(self.credential, AzureKeyCredential):
173-
return policies.AzureKeyCredentialPolicy(self.credential, "api-key", **kwargs)
174167
if hasattr(self.credential, "get_token"):
175168
return policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
176169
raise TypeError(f"Unsupported credential: {self.credential}")

0 commit comments

Comments
 (0)