Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AutoPR azure-ai-inference] Merge C# feature branch into main Azure.AI.Inference branch #9664

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions sdk/ai/azure-ai-inference/_meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"commit": "181255fe8641551456edd3ba2bc4907dab8220f2",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"typespec_src": "specification/ai/ModelClient",
"@azure-tools/typespec-python": "0.38.4"
}
41 changes: 41 additions & 0 deletions sdk/ai/azure-ai-inference/apiview-properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"CrossLanguagePackageId": "AI.Model",
"CrossLanguageDefinitionId": {
"azure.ai.inference.models.ContentItem": "AI.Model.ChatMessageContentItem",
"azure.ai.inference.models.AudioDataContentItem": "AI.Model.ChatMessageAudioDataContentItem",
"azure.ai.inference.models.AudioUrlContentItem": "AI.Model.ChatMessageAudioUrlContentItem",
"azure.ai.inference.models.ChatChoice": "AI.Model.ChatChoice",
"azure.ai.inference.models.ChatCompletions": "AI.Model.ChatCompletions",
"azure.ai.inference.models.ChatCompletionsNamedToolChoice": "AI.Model.ChatCompletionsNamedToolChoice",
"azure.ai.inference.models.ChatCompletionsNamedToolChoiceFunction": "AI.Model.ChatCompletionsNamedToolChoiceFunction",
"azure.ai.inference.models.ChatCompletionsToolCall": "AI.Model.ChatCompletionsToolCall",
"azure.ai.inference.models.ChatCompletionsToolDefinition": "AI.Model.ChatCompletionsToolDefinition",
"azure.ai.inference.models.ChatResponseMessage": "AI.Model.ChatResponseMessage",
"azure.ai.inference.models.CompletionsUsage": "AI.Model.CompletionsUsage",
"azure.ai.inference.models.EmbeddingItem": "AI.Model.EmbeddingItem",
"azure.ai.inference.models.EmbeddingsResult": "AI.Model.EmbeddingsResult",
"azure.ai.inference.models.EmbeddingsUsage": "AI.Model.EmbeddingsUsage",
"azure.ai.inference.models.FunctionCall": "AI.Model.FunctionCall",
"azure.ai.inference.models.FunctionDefinition": "AI.Model.FunctionDefinition",
"azure.ai.inference.models.ImageContentItem": "AI.Model.ChatMessageImageContentItem",
"azure.ai.inference.models.ImageEmbeddingInput": "AI.Model.ImageEmbeddingInput",
"azure.ai.inference.models.ImageUrl": "AI.Model.ChatMessageImageUrl",
"azure.ai.inference.models.InputAudio": "AI.Model.ChatMessageInputAudio",
"azure.ai.inference.models.InputAudioUrl": "AI.Model.ChatMessageInputAudioUrl",
"azure.ai.inference.models.JsonSchemaFormat": "AI.Model.ChatCompletionsResponseFormatJsonSchemaDefinition",
"azure.ai.inference.models.ModelInfo": "AI.Model.ModelInfo",
"azure.ai.inference.models.StreamingChatChoiceUpdate": "AI.Model.StreamingChatChoiceUpdate",
"azure.ai.inference.models.StreamingChatCompletionsUpdate": "AI.Model.StreamingChatCompletionsUpdate",
"azure.ai.inference.models.StreamingChatResponseMessageUpdate": "AI.Model.StreamingChatResponseMessageUpdate",
"azure.ai.inference.models.StreamingChatResponseToolCallUpdate": "AI.Model.StreamingChatResponseToolCallUpdate",
"azure.ai.inference.models.TextContentItem": "AI.Model.ChatMessageTextContentItem",
"azure.ai.inference.models.CompletionsFinishReason": "AI.Model.CompletionsFinishReason",
"azure.ai.inference.models.ChatRole": "AI.Model.ChatRole",
"azure.ai.inference.models.ImageDetailLevel": "AI.Model.ChatMessageImageDetailLevel",
"azure.ai.inference.models.AudioContentFormat": "AI.Model.AudioContentFormat",
"azure.ai.inference.models.ChatCompletionsToolChoicePreset": "AI.Model.ChatCompletionsToolChoicePreset",
"azure.ai.inference.models.ModelType": "AI.Model.ModelType",
"azure.ai.inference.models.EmbeddingEncodingFormat": "AI.Model.EmbeddingEncodingFormat",
"azure.ai.inference.models.EmbeddingInputType": "AI.Model.EmbeddingInputType"
}
}
6 changes: 3 additions & 3 deletions sdk/ai/azure-ai-inference/azure/ai/inference/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class ChatCompletionsClient(ChatCompletionsClientOperationsMixin):
:param credential: Credential used to authenticate requests to the service. Is either a key
credential type or a token credential type. Required.
:type credential: ~azure.core.credentials.AzureKeyCredential or
~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials.TokenCredential
~azure.core.credentials.TokenCredential
:keyword api_version: The API version to use for this operation. Default value is
"2024-05-01-preview". Note that overriding this default value may result in unsupported
behavior.
Expand Down Expand Up @@ -117,7 +117,7 @@ class EmbeddingsClient(EmbeddingsClientOperationsMixin):
:param credential: Credential used to authenticate requests to the service. Is either a key
credential type or a token credential type. Required.
:type credential: ~azure.core.credentials.AzureKeyCredential or
~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials.TokenCredential
~azure.core.credentials.TokenCredential
:keyword api_version: The API version to use for this operation. Default value is
"2024-05-01-preview". Note that overriding this default value may result in unsupported
behavior.
Expand Down Expand Up @@ -195,7 +195,7 @@ class ImageEmbeddingsClient(ImageEmbeddingsClientOperationsMixin):
:param credential: Credential used to authenticate requests to the service. Is either a key
credential type or a token credential type. Required.
:type credential: ~azure.core.credentials.AzureKeyCredential or
~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials.TokenCredential
~azure.core.credentials.TokenCredential
:keyword api_version: The API version to use for this operation. Default value is
"2024-05-01-preview". Note that overriding this default value may result in unsupported
behavior.
Expand Down
12 changes: 3 additions & 9 deletions sdk/ai/azure-ai-inference/azure/ai/inference/_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class ChatCompletionsClientConfiguration: # pylint: disable=too-many-instance-a
:param credential: Credential used to authenticate requests to the service. Is either a key
credential type or a token credential type. Required.
:type credential: ~azure.core.credentials.AzureKeyCredential or
~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials.TokenCredential
~azure.core.credentials.TokenCredential
:keyword api_version: The API version to use for this operation. Default value is
"2024-05-01-preview". Note that overriding this default value may result in unsupported
behavior.
Expand All @@ -54,8 +54,6 @@ def __init__(self, endpoint: str, credential: Union[AzureKeyCredential, "TokenCr
def _infer_policy(self, **kwargs):
if isinstance(self.credential, AzureKeyCredential):
return policies.AzureKeyCredentialPolicy(self.credential, "Authorization", prefix="Bearer", **kwargs)
if isinstance(self.credential, AzureKeyCredential):
return policies.AzureKeyCredentialPolicy(self.credential, "api-key", **kwargs)
if hasattr(self.credential, "get_token"):
return policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
raise TypeError(f"Unsupported credential: {self.credential}")
Expand Down Expand Up @@ -85,7 +83,7 @@ class EmbeddingsClientConfiguration: # pylint: disable=too-many-instance-attrib
:param credential: Credential used to authenticate requests to the service. Is either a key
credential type or a token credential type. Required.
:type credential: ~azure.core.credentials.AzureKeyCredential or
~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials.TokenCredential
~azure.core.credentials.TokenCredential
:keyword api_version: The API version to use for this operation. Default value is
"2024-05-01-preview". Note that overriding this default value may result in unsupported
behavior.
Expand All @@ -111,8 +109,6 @@ def __init__(self, endpoint: str, credential: Union[AzureKeyCredential, "TokenCr
def _infer_policy(self, **kwargs):
if isinstance(self.credential, AzureKeyCredential):
return policies.AzureKeyCredentialPolicy(self.credential, "Authorization", prefix="Bearer", **kwargs)
if isinstance(self.credential, AzureKeyCredential):
return policies.AzureKeyCredentialPolicy(self.credential, "api-key", **kwargs)
if hasattr(self.credential, "get_token"):
return policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
raise TypeError(f"Unsupported credential: {self.credential}")
Expand Down Expand Up @@ -142,7 +138,7 @@ class ImageEmbeddingsClientConfiguration: # pylint: disable=too-many-instance-a
:param credential: Credential used to authenticate requests to the service. Is either a key
credential type or a token credential type. Required.
:type credential: ~azure.core.credentials.AzureKeyCredential or
~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials.TokenCredential
~azure.core.credentials.TokenCredential
:keyword api_version: The API version to use for this operation. Default value is
"2024-05-01-preview". Note that overriding this default value may result in unsupported
behavior.
Expand All @@ -168,8 +164,6 @@ def __init__(self, endpoint: str, credential: Union[AzureKeyCredential, "TokenCr
def _infer_policy(self, **kwargs):
if isinstance(self.credential, AzureKeyCredential):
return policies.AzureKeyCredentialPolicy(self.credential, "Authorization", prefix="Bearer", **kwargs)
if isinstance(self.credential, AzureKeyCredential):
return policies.AzureKeyCredentialPolicy(self.credential, "api-key", **kwargs)
if hasattr(self.credential, "get_token"):
return policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
raise TypeError(f"Unsupported credential: {self.credential}")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# pylint: disable=too-many-lines,arguments-differ,signature-differs,no-member
# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
Expand Down
Loading