diff --git a/sdk/ai/Azure.AI.Inference/src/Generated/AIInferenceModelFactory.cs b/sdk/ai/Azure.AI.Inference/src/Generated/AIInferenceModelFactory.cs
index 8bd673de3aa2..6e375a158197 100644
--- a/sdk/ai/Azure.AI.Inference/src/Generated/AIInferenceModelFactory.cs
+++ b/sdk/ai/Azure.AI.Inference/src/Generated/AIInferenceModelFactory.cs
@@ -92,22 +92,50 @@ public static ChatChoice ChatChoice(int index = default, CompletionsFinishReason
/// The tool calls that must be resolved and have their outputs appended to subsequent input messages for the chat
/// completions request to resolve as configured.
///
+ /// The reasoning content the model used for generating the response.
/// A new instance for mocking.
- public static ChatResponseMessage ChatResponseMessage(ChatRole role = default, string content = null, IEnumerable toolCalls = null)
+ public static ChatResponseMessage ChatResponseMessage(ChatRole role = default, string content = null, IEnumerable toolCalls = null, string reasoningContent = null)
{
toolCalls ??= new List();
- return new ChatResponseMessage(role, content, toolCalls?.ToList(), serializedAdditionalRawData: null);
+ return new ChatResponseMessage(role, content, toolCalls?.ToList(), reasoningContent, serializedAdditionalRawData: null);
}
/// Initializes a new instance of .
/// The number of tokens generated across all completions emissions.
/// The number of tokens in the provided prompts for the completions request.
/// The total number of tokens processed for the completions request and response.
+ /// Breakdown of tokens used in a completion.
+ /// Breakdown of tokens used in the prompt/chat history.
/// A new instance for mocking.
- public static CompletionsUsage CompletionsUsage(int completionTokens = default, int promptTokens = default, int totalTokens = default)
+ public static CompletionsUsage CompletionsUsage(int completionTokens = default, int promptTokens = default, int totalTokens = default, CompletionsUsageDetails completionTokensDetails = null, PromptUsageDetails promptTokensDetails = null)
{
- return new CompletionsUsage(completionTokens, promptTokens, totalTokens, serializedAdditionalRawData: null);
+ return new CompletionsUsage(
+ completionTokens,
+ promptTokens,
+ totalTokens,
+ completionTokensDetails,
+ promptTokensDetails,
+ serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// The number of tokens corresponding to audio input.
+ /// The number of tokens corresponding to reasoning.
+ /// The total number of tokens processed for the completions request and response.
+ /// A new instance for mocking.
+ public static CompletionsUsageDetails CompletionsUsageDetails(int audioTokens = default, int reasoningTokens = default, int totalTokens = default)
+ {
+ return new CompletionsUsageDetails(audioTokens, reasoningTokens, totalTokens, serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// The number of tokens corresponding to audio input.
+ /// The total number of tokens cached.
+ /// A new instance for mocking.
+ public static PromptUsageDetails PromptUsageDetails(int audioTokens = default, int cachedTokens = default)
+ {
+ return new PromptUsageDetails(audioTokens, cachedTokens, serializedAdditionalRawData: null);
}
/// Initializes a new instance of .
@@ -213,12 +241,13 @@ public static StreamingChatChoiceUpdate StreamingChatChoiceUpdate(int index = de
/// The tool calls that must be resolved and have their outputs appended to subsequent input messages for the chat
/// completions request to resolve as configured.
///
+ /// The reasoning content the model used for generating the response.
/// A new instance for mocking.
- public static StreamingChatResponseMessageUpdate StreamingChatResponseMessageUpdate(ChatRole? role = null, string content = null, IEnumerable toolCalls = null)
+ public static StreamingChatResponseMessageUpdate StreamingChatResponseMessageUpdate(ChatRole? role = null, string content = null, IEnumerable toolCalls = null, string reasoningContent = null)
{
toolCalls ??= new List();
- return new StreamingChatResponseMessageUpdate(role, content, toolCalls?.ToList(), serializedAdditionalRawData: null);
+ return new StreamingChatResponseMessageUpdate(role, content, toolCalls?.ToList(), reasoningContent, serializedAdditionalRawData: null);
}
/// Initializes a new instance of .
diff --git a/sdk/ai/Azure.AI.Inference/src/Generated/AzureAIInferenceClientOptions.cs b/sdk/ai/Azure.AI.Inference/src/Generated/AzureAIInferenceClientOptions.cs
index 46dcb4716cad..19ad5ae20fdf 100644
--- a/sdk/ai/Azure.AI.Inference/src/Generated/AzureAIInferenceClientOptions.cs
+++ b/sdk/ai/Azure.AI.Inference/src/Generated/AzureAIInferenceClientOptions.cs
@@ -13,13 +13,13 @@ namespace Azure.AI.Inference
/// Client options for Azure.AI.Inference library clients.
public partial class AzureAIInferenceClientOptions : ClientOptions
{
- private const ServiceVersion LatestVersion = ServiceVersion.V2024_05_01_Preview;
+ private const ServiceVersion LatestVersion = ServiceVersion.V2025_04_01;
/// The version of the service to use.
public enum ServiceVersion
{
- /// Service version "2024-05-01-preview".
- V2024_05_01_Preview = 1,
+ /// Service version "2025-04-01".
+ V2025_04_01 = 1,
}
internal string Version { get; }
@@ -29,7 +29,7 @@ public AzureAIInferenceClientOptions(ServiceVersion version = LatestVersion)
{
Version = version switch
{
- ServiceVersion.V2024_05_01_Preview => "2024-05-01-preview",
+ ServiceVersion.V2025_04_01 => "2025-04-01",
_ => throw new NotSupportedException()
};
}
diff --git a/sdk/ai/Azure.AI.Inference/src/Generated/ChatCompletionsClient.cs b/sdk/ai/Azure.AI.Inference/src/Generated/ChatCompletionsClient.cs
index 4bd774289ef0..cc3a010486ba 100644
--- a/sdk/ai/Azure.AI.Inference/src/Generated/ChatCompletionsClient.cs
+++ b/sdk/ai/Azure.AI.Inference/src/Generated/ChatCompletionsClient.cs
@@ -20,7 +20,7 @@ public partial class ChatCompletionsClient
private const string AuthorizationHeader = "Authorization";
private readonly AzureKeyCredential _keyCredential;
private const string AuthorizationApiKeyPrefix = "Bearer";
- private static readonly string[] AuthorizationScopes = new string[] { "https://ml.azure.com/.default" };
+ private static readonly string[] AuthorizationScopes = new string[] { "https://cognitiveservices.azure.com/.default" };
private readonly TokenCredential _tokenCredential;
private readonly HttpPipeline _pipeline;
private readonly Uri _endpoint;
@@ -75,14 +75,15 @@ public ChatCompletionsClient(Uri endpoint, TokenCredential credential, AzureAIIn
/// Returns information about the AI model.
/// The method makes a REST API call to the `/info` route on the given endpoint.
/// This method will only work when using Serverless API or Managed Compute endpoint.
- /// It will not work for GitHub Models endpoint or Azure OpenAI endpoint.
+ /// It will not work for Azure OpenAI endpoints.
///
+ /// The model deployment name you want information from.
/// The cancellation token to use.
- ///
- public virtual async Task> GetModelInfoAsync(CancellationToken cancellationToken = default)
+ ///
+ public virtual async Task> GetModelInfoAsync(string model = null, CancellationToken cancellationToken = default)
{
RequestContext context = FromCancellationToken(cancellationToken);
- Response response = await GetModelInfoAsync(context).ConfigureAwait(false);
+ Response response = await GetModelInfoAsync(model, context).ConfigureAwait(false);
return Response.FromValue(ModelInfo.FromResponse(response), response);
}
@@ -90,14 +91,15 @@ public virtual async Task> GetModelInfoAsync(CancellationTok
/// Returns information about the AI model.
/// The method makes a REST API call to the `/info` route on the given endpoint.
/// This method will only work when using Serverless API or Managed Compute endpoint.
- /// It will not work for GitHub Models endpoint or Azure OpenAI endpoint.
+ /// It will not work for Azure OpenAI endpoints.
///
+ /// The model deployment name you want information from.
/// The cancellation token to use.
- ///
- public virtual Response GetModelInfo(CancellationToken cancellationToken = default)
+ ///
+ public virtual Response GetModelInfo(string model = null, CancellationToken cancellationToken = default)
{
RequestContext context = FromCancellationToken(cancellationToken);
- Response response = GetModelInfo(context);
+ Response response = GetModelInfo(model, context);
return Response.FromValue(ModelInfo.FromResponse(response), response);
}
@@ -105,7 +107,7 @@ public virtual Response GetModelInfo(CancellationToken cancellationTo
/// [Protocol Method] Returns information about the AI model.
/// The method makes a REST API call to the `/info` route on the given endpoint.
/// This method will only work when using Serverless API or Managed Compute endpoint.
- /// It will not work for GitHub Models endpoint or Azure OpenAI endpoint.
+ /// It will not work for Azure OpenAI endpoints.
///
/// -
///
@@ -114,22 +116,23 @@ public virtual Response GetModelInfo(CancellationToken cancellationTo
///
/// -
///
- /// Please try the simpler convenience overload with strongly typed models first.
+ /// Please try the simpler convenience overload with strongly typed models first.
///
///
///
///
+ /// The model deployment name you want information from.
/// The request context, which can override default behaviors of the client pipeline on a per-call basis.
/// Service returned a non-success status code.
/// The response returned from the service.
- ///
- public virtual async Task GetModelInfoAsync(RequestContext context)
+ ///
+ public virtual async Task GetModelInfoAsync(string model, RequestContext context)
{
using var scope = ClientDiagnostics.CreateScope("ChatCompletionsClient.GetModelInfo");
scope.Start();
try
{
- using HttpMessage message = CreateGetModelInfoRequest(context);
+ using HttpMessage message = CreateGetModelInfoRequest(model, context);
return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
}
catch (Exception e)
@@ -143,7 +146,7 @@ public virtual async Task GetModelInfoAsync(RequestContext context)
/// [Protocol Method] Returns information about the AI model.
/// The method makes a REST API call to the `/info` route on the given endpoint.
/// This method will only work when using Serverless API or Managed Compute endpoint.
- /// It will not work for GitHub Models endpoint or Azure OpenAI endpoint.
+ /// It will not work for Azure OpenAI endpoints.
///
/// -
///
@@ -152,22 +155,23 @@ public virtual async Task GetModelInfoAsync(RequestContext context)
///
/// -
///
- /// Please try the simpler convenience overload with strongly typed models first.
+ /// Please try the simpler convenience overload with strongly typed models first.
///
///
///
///
+ /// The model deployment name you want information from.
/// The request context, which can override default behaviors of the client pipeline on a per-call basis.
/// Service returned a non-success status code.
/// The response returned from the service.
- ///
- public virtual Response GetModelInfo(RequestContext context)
+ ///
+ public virtual Response GetModelInfo(string model, RequestContext context)
{
using var scope = ClientDiagnostics.CreateScope("ChatCompletionsClient.GetModelInfo");
scope.Start();
try
{
- using HttpMessage message = CreateGetModelInfoRequest(context);
+ using HttpMessage message = CreateGetModelInfoRequest(model, context);
return _pipeline.ProcessMessage(message, context);
}
catch (Exception e)
@@ -197,7 +201,7 @@ internal HttpMessage CreateCompleteRequest(RequestContent content, string extraP
return message;
}
- internal HttpMessage CreateGetModelInfoRequest(RequestContext context)
+ internal HttpMessage CreateGetModelInfoRequest(string model, RequestContext context)
{
var message = _pipeline.CreateMessage(context, ResponseClassifier200);
var request = message.Request;
@@ -206,6 +210,10 @@ internal HttpMessage CreateGetModelInfoRequest(RequestContext context)
uri.Reset(_endpoint);
uri.AppendPath("/info", false);
uri.AppendQuery("api-version", _apiVersion, true);
+ if (model != null)
+ {
+ uri.AppendQuery("model", model, true);
+ }
request.Uri = uri;
request.Headers.Add("Accept", "application/json");
return message;
diff --git a/sdk/ai/Azure.AI.Inference/src/Generated/ChatResponseMessage.Serialization.cs b/sdk/ai/Azure.AI.Inference/src/Generated/ChatResponseMessage.Serialization.cs
index 610cf44dd156..18a5f47526df 100644
--- a/sdk/ai/Azure.AI.Inference/src/Generated/ChatResponseMessage.Serialization.cs
+++ b/sdk/ai/Azure.AI.Inference/src/Generated/ChatResponseMessage.Serialization.cs
@@ -55,6 +55,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit
}
writer.WriteEndArray();
}
+ if (options.Format != "W" && Optional.IsDefined(ReasoningContent))
+ {
+ writer.WritePropertyName("reasoning_content"u8);
+ writer.WriteStringValue(ReasoningContent);
+ }
if (options.Format != "W" && _serializedAdditionalRawData != null)
{
foreach (var item in _serializedAdditionalRawData)
@@ -95,6 +100,7 @@ internal static ChatResponseMessage DeserializeChatResponseMessage(JsonElement e
ChatRole role = default;
string content = default;
IReadOnlyList toolCalls = default;
+ string reasoningContent = default;
IDictionary serializedAdditionalRawData = default;
Dictionary rawDataDictionary = new Dictionary();
foreach (var property in element.EnumerateObject())
@@ -128,13 +134,18 @@ internal static ChatResponseMessage DeserializeChatResponseMessage(JsonElement e
toolCalls = array;
continue;
}
+ if (property.NameEquals("reasoning_content"u8))
+ {
+ reasoningContent = property.Value.GetString();
+ continue;
+ }
if (options.Format != "W")
{
rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
}
}
serializedAdditionalRawData = rawDataDictionary;
- return new ChatResponseMessage(role, content, toolCalls ?? new ChangeTrackingList(), serializedAdditionalRawData);
+ return new ChatResponseMessage(role, content, toolCalls ?? new ChangeTrackingList(), reasoningContent, serializedAdditionalRawData);
}
BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
diff --git a/sdk/ai/Azure.AI.Inference/src/Generated/ChatResponseMessage.cs b/sdk/ai/Azure.AI.Inference/src/Generated/ChatResponseMessage.cs
index 6ba151e01adb..0ddd55f6c798 100644
--- a/sdk/ai/Azure.AI.Inference/src/Generated/ChatResponseMessage.cs
+++ b/sdk/ai/Azure.AI.Inference/src/Generated/ChatResponseMessage.cs
@@ -62,12 +62,14 @@ internal ChatResponseMessage(ChatRole role, string content)
/// The tool calls that must be resolved and have their outputs appended to subsequent input messages for the chat
/// completions request to resolve as configured.
///
+ /// The reasoning content the model used for generating the response.
/// Keeps track of any properties unknown to the library.
- internal ChatResponseMessage(ChatRole role, string content, IReadOnlyList toolCalls, IDictionary serializedAdditionalRawData)
+ internal ChatResponseMessage(ChatRole role, string content, IReadOnlyList toolCalls, string reasoningContent, IDictionary serializedAdditionalRawData)
{
Role = role;
Content = content;
ToolCalls = toolCalls;
+ ReasoningContent = reasoningContent;
_serializedAdditionalRawData = serializedAdditionalRawData;
}
@@ -85,5 +87,7 @@ internal ChatResponseMessage()
/// completions request to resolve as configured.
///
public IReadOnlyList ToolCalls { get; }
+ /// The reasoning content the model used for generating the response.
+ public string ReasoningContent { get; }
}
}
diff --git a/sdk/ai/Azure.AI.Inference/src/Generated/CompletionsUsage.Serialization.cs b/sdk/ai/Azure.AI.Inference/src/Generated/CompletionsUsage.Serialization.cs
index b98b9ffc340a..11418dbf6166 100644
--- a/sdk/ai/Azure.AI.Inference/src/Generated/CompletionsUsage.Serialization.cs
+++ b/sdk/ai/Azure.AI.Inference/src/Generated/CompletionsUsage.Serialization.cs
@@ -40,6 +40,16 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit
writer.WriteNumberValue(PromptTokens);
writer.WritePropertyName("total_tokens"u8);
writer.WriteNumberValue(TotalTokens);
+ if (Optional.IsDefined(CompletionTokensDetails))
+ {
+ writer.WritePropertyName("completion_tokens_details"u8);
+ writer.WriteObjectValue(CompletionTokensDetails, options);
+ }
+ if (Optional.IsDefined(PromptTokensDetails))
+ {
+ writer.WritePropertyName("prompt_tokens_details"u8);
+ writer.WriteObjectValue(PromptTokensDetails, options);
+ }
if (options.Format != "W" && _serializedAdditionalRawData != null)
{
foreach (var item in _serializedAdditionalRawData)
@@ -80,6 +90,8 @@ internal static CompletionsUsage DeserializeCompletionsUsage(JsonElement element
int completionTokens = default;
int promptTokens = default;
int totalTokens = default;
+ CompletionsUsageDetails completionTokensDetails = default;
+ PromptUsageDetails promptTokensDetails = default;
IDictionary serializedAdditionalRawData = default;
Dictionary rawDataDictionary = new Dictionary();
foreach (var property in element.EnumerateObject())
@@ -99,13 +111,37 @@ internal static CompletionsUsage DeserializeCompletionsUsage(JsonElement element
totalTokens = property.Value.GetInt32();
continue;
}
+ if (property.NameEquals("completion_tokens_details"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ completionTokensDetails = CompletionsUsageDetails.DeserializeCompletionsUsageDetails(property.Value, options);
+ continue;
+ }
+ if (property.NameEquals("prompt_tokens_details"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ promptTokensDetails = PromptUsageDetails.DeserializePromptUsageDetails(property.Value, options);
+ continue;
+ }
if (options.Format != "W")
{
rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
}
}
serializedAdditionalRawData = rawDataDictionary;
- return new CompletionsUsage(completionTokens, promptTokens, totalTokens, serializedAdditionalRawData);
+ return new CompletionsUsage(
+ completionTokens,
+ promptTokens,
+ totalTokens,
+ completionTokensDetails,
+ promptTokensDetails,
+ serializedAdditionalRawData);
}
BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
diff --git a/sdk/ai/Azure.AI.Inference/src/Generated/CompletionsUsage.cs b/sdk/ai/Azure.AI.Inference/src/Generated/CompletionsUsage.cs
index b6affee7b206..066b89663732 100644
--- a/sdk/ai/Azure.AI.Inference/src/Generated/CompletionsUsage.cs
+++ b/sdk/ai/Azure.AI.Inference/src/Generated/CompletionsUsage.cs
@@ -64,12 +64,16 @@ internal CompletionsUsage(int completionTokens, int promptTokens, int totalToken
/// The number of tokens generated across all completions emissions.
/// The number of tokens in the provided prompts for the completions request.
/// The total number of tokens processed for the completions request and response.
+ /// Breakdown of tokens used in a completion.
+ /// Breakdown of tokens used in the prompt/chat history.
/// Keeps track of any properties unknown to the library.
- internal CompletionsUsage(int completionTokens, int promptTokens, int totalTokens, IDictionary serializedAdditionalRawData)
+ internal CompletionsUsage(int completionTokens, int promptTokens, int totalTokens, CompletionsUsageDetails completionTokensDetails, PromptUsageDetails promptTokensDetails, IDictionary serializedAdditionalRawData)
{
CompletionTokens = completionTokens;
PromptTokens = promptTokens;
TotalTokens = totalTokens;
+ CompletionTokensDetails = completionTokensDetails;
+ PromptTokensDetails = promptTokensDetails;
_serializedAdditionalRawData = serializedAdditionalRawData;
}
@@ -84,5 +88,9 @@ internal CompletionsUsage()
public int PromptTokens { get; }
/// The total number of tokens processed for the completions request and response.
public int TotalTokens { get; }
+ /// Breakdown of tokens used in a completion.
+ public CompletionsUsageDetails CompletionTokensDetails { get; }
+ /// Breakdown of tokens used in the prompt/chat history.
+ public PromptUsageDetails PromptTokensDetails { get; }
}
}
diff --git a/sdk/ai/Azure.AI.Inference/src/Generated/CompletionsUsageDetails.Serialization.cs b/sdk/ai/Azure.AI.Inference/src/Generated/CompletionsUsageDetails.Serialization.cs
new file mode 100644
index 000000000000..e4a4e1f5b8fa
--- /dev/null
+++ b/sdk/ai/Azure.AI.Inference/src/Generated/CompletionsUsageDetails.Serialization.cs
@@ -0,0 +1,167 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel.Primitives;
+using System.Collections.Generic;
+using System.Text.Json;
+using Azure.Core;
+
+namespace Azure.AI.Inference
+{
+ public partial class CompletionsUsageDetails : IUtf8JsonSerializable, IJsonModel
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
+
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
+ {
+ writer.WriteStartObject();
+ JsonModelWriteCore(writer, options);
+ writer.WriteEndObject();
+ }
+
+ /// The JSON writer.
+ /// The client options for reading and writing models.
+ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(CompletionsUsageDetails)} does not support writing '{format}' format.");
+ }
+
+ if (options.Format != "W")
+ {
+ writer.WritePropertyName("audio_tokens"u8);
+ writer.WriteNumberValue(AudioTokens);
+ }
+ if (options.Format != "W")
+ {
+ writer.WritePropertyName("reasoning_tokens"u8);
+ writer.WriteNumberValue(ReasoningTokens);
+ }
+ if (options.Format != "W")
+ {
+ writer.WritePropertyName("total_tokens"u8);
+ writer.WriteNumberValue(TotalTokens);
+ }
+ if (options.Format != "W" && _serializedAdditionalRawData != null)
+ {
+ foreach (var item in _serializedAdditionalRawData)
+ {
+ writer.WritePropertyName(item.Key);
+#if NET6_0_OR_GREATER
+ writer.WriteRawValue(item.Value);
+#else
+ using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions))
+ {
+ JsonSerializer.Serialize(writer, document.RootElement);
+ }
+#endif
+ }
+ }
+ }
+
+ CompletionsUsageDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(CompletionsUsageDetails)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeCompletionsUsageDetails(document.RootElement, options);
+ }
+
+ internal static CompletionsUsageDetails DeserializeCompletionsUsageDetails(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ int audioTokens = default;
+ int reasoningTokens = default;
+ int totalTokens = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("audio_tokens"u8))
+ {
+ audioTokens = property.Value.GetInt32();
+ continue;
+ }
+ if (property.NameEquals("reasoning_tokens"u8))
+ {
+ reasoningTokens = property.Value.GetInt32();
+ continue;
+ }
+ if (property.NameEquals("total_tokens"u8))
+ {
+ totalTokens = property.Value.GetInt32();
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new CompletionsUsageDetails(audioTokens, reasoningTokens, totalTokens, serializedAdditionalRawData);
+ }
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ return ModelReaderWriter.Write(this, options);
+ default:
+ throw new FormatException($"The model {nameof(CompletionsUsageDetails)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ CompletionsUsageDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ {
+ using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions);
+ return DeserializeCompletionsUsageDetails(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(CompletionsUsageDetails)} does not support reading '{options.Format}' format.");
+ }
+ }
+
+ string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static CompletionsUsageDetails FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions);
+ return DeserializeCompletionsUsageDetails(document.RootElement);
+ }
+
+ /// Convert into a .
+ internal virtual RequestContent ToRequestContent()
+ {
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions);
+ return content;
+ }
+ }
+}
diff --git a/sdk/ai/Azure.AI.Inference/src/Generated/CompletionsUsageDetails.cs b/sdk/ai/Azure.AI.Inference/src/Generated/CompletionsUsageDetails.cs
new file mode 100644
index 000000000000..7ad4f9c10b1e
--- /dev/null
+++ b/sdk/ai/Azure.AI.Inference/src/Generated/CompletionsUsageDetails.cs
@@ -0,0 +1,73 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+
+namespace Azure.AI.Inference
+{
+ /// A breakdown of tokens used in a completion.
+ public partial class CompletionsUsageDetails
+ {
+ ///
+ /// Keeps track of any properties unknown to the library.
+ ///
+ /// To assign an object to the value of this property use .
+ ///
+ ///
+ /// To assign an already formatted json string to this property use .
+ ///
+ ///
+ /// Examples:
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson("foo")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromString("\"foo\"")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson(new { key = "value" })
+ /// Creates a payload of { "key": "value" }.
+ ///
+ /// -
+ /// BinaryData.FromString("{\"key\": \"value\"}")
+ /// Creates a payload of { "key": "value" }.
+ ///
+ ///
+ ///
+ ///
+ private IDictionary _serializedAdditionalRawData;
+
+ /// Initializes a new instance of .
+ internal CompletionsUsageDetails()
+ {
+ }
+
+ /// Initializes a new instance of .
+ /// The number of tokens corresponding to audio input.
+ /// The number of tokens corresponding to reasoning.
+ /// The total number of tokens processed for the completions request and response.
+ /// Keeps track of any properties unknown to the library.
+ internal CompletionsUsageDetails(int audioTokens, int reasoningTokens, int totalTokens, IDictionary serializedAdditionalRawData)
+ {
+ AudioTokens = audioTokens;
+ ReasoningTokens = reasoningTokens;
+ TotalTokens = totalTokens;
+ _serializedAdditionalRawData = serializedAdditionalRawData;
+ }
+
+ /// The number of tokens corresponding to audio input.
+ public int AudioTokens { get; }
+ /// The number of tokens corresponding to reasoning.
+ public int ReasoningTokens { get; }
+ /// The total number of tokens processed for the completions request and response.
+ public int TotalTokens { get; }
+ }
+}
diff --git a/sdk/ai/Azure.AI.Inference/src/Generated/Docs/ChatCompletionsClient.xml b/sdk/ai/Azure.AI.Inference/src/Generated/Docs/ChatCompletionsClient.xml
index 572d47b762f2..0ea9e9e5c48f 100644
--- a/sdk/ai/Azure.AI.Inference/src/Generated/Docs/ChatCompletionsClient.xml
+++ b/sdk/ai/Azure.AI.Inference/src/Generated/Docs/ChatCompletionsClient.xml
@@ -1,7 +1,7 @@
-
+
This sample shows how to call GetModelInfoAsync.
response = await client.GetModelInfoAsync();
]]>
-This sample shows how to call GetModelInfoAsync.
+This sample shows how to call GetModelInfoAsync with all parameters.
");
AzureKeyCredential credential = new AzureKeyCredential("");
ChatCompletionsClient client = new ChatCompletionsClient(endpoint, credential);
-Response response = await client.GetModelInfoAsync();
+Response response = await client.GetModelInfoAsync(model: "");
]]>
-
+
This sample shows how to call GetModelInfo.
response = client.GetModelInfo();
]]>
-This sample shows how to call GetModelInfo.
+This sample shows how to call GetModelInfo with all parameters.
");
AzureKeyCredential credential = new AzureKeyCredential("");
ChatCompletionsClient client = new ChatCompletionsClient(endpoint, credential);
-Response response = client.GetModelInfo();
+Response response = client.GetModelInfo(model: "");
]]>
-
+
This sample shows how to call GetModelInfoAsync and parse the result.
");
AzureKeyCredential credential = new AzureKeyCredential("");
ChatCompletionsClient client = new ChatCompletionsClient(endpoint, credential);
-Response response = await client.GetModelInfoAsync(null);
+Response response = await client.GetModelInfoAsync(null, null);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("model_name").ToString());
Console.WriteLine(result.GetProperty("model_type").ToString());
Console.WriteLine(result.GetProperty("model_provider_name").ToString());
]]>
-This sample shows how to call GetModelInfoAsync and parse the result.
+This sample shows how to call GetModelInfoAsync with all parameters and parse the result.
");
AzureKeyCredential credential = new AzureKeyCredential("");
ChatCompletionsClient client = new ChatCompletionsClient(endpoint, credential);
-Response response = await client.GetModelInfoAsync(null);
+Response response = await client.GetModelInfoAsync("", null);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("model_name").ToString());
@@ -68,7 +68,7 @@ Console.WriteLine(result.GetProperty("model_type").ToString());
Console.WriteLine(result.GetProperty("model_provider_name").ToString());
]]>
-
+
This sample shows how to call GetModelInfo and parse the result.
");
AzureKeyCredential credential = new AzureKeyCredential("");
ChatCompletionsClient client = new ChatCompletionsClient(endpoint, credential);
-Response response = client.GetModelInfo(null);
+Response response = client.GetModelInfo(null, null);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("model_name").ToString());
Console.WriteLine(result.GetProperty("model_type").ToString());
Console.WriteLine(result.GetProperty("model_provider_name").ToString());
]]>
-This sample shows how to call GetModelInfo and parse the result.
+This sample shows how to call GetModelInfo with all parameters and parse the result.
");
AzureKeyCredential credential = new AzureKeyCredential("");
ChatCompletionsClient client = new ChatCompletionsClient(endpoint, credential);
-Response response = client.GetModelInfo(null);
+Response response = client.GetModelInfo("", null);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("model_name").ToString());
diff --git a/sdk/ai/Azure.AI.Inference/src/Generated/Docs/EmbeddingsClient.xml b/sdk/ai/Azure.AI.Inference/src/Generated/Docs/EmbeddingsClient.xml
index 54f0260f0b6b..f63c4d5026ba 100644
--- a/sdk/ai/Azure.AI.Inference/src/Generated/Docs/EmbeddingsClient.xml
+++ b/sdk/ai/Azure.AI.Inference/src/Generated/Docs/EmbeddingsClient.xml
@@ -1,7 +1,7 @@
-
+
This sample shows how to call GetModelInfoAsync.
response = await client.GetModelInfoAsync();
]]>
-This sample shows how to call GetModelInfoAsync.
+This sample shows how to call GetModelInfoAsync with all parameters.
");
AzureKeyCredential credential = new AzureKeyCredential("");
EmbeddingsClient client = new EmbeddingsClient(endpoint, credential);
-Response response = await client.GetModelInfoAsync();
+Response response = await client.GetModelInfoAsync(model: "");
]]>
-
+
This sample shows how to call GetModelInfo.
response = client.GetModelInfo();
]]>
-This sample shows how to call GetModelInfo.
+This sample shows how to call GetModelInfo with all parameters.
");
AzureKeyCredential credential = new AzureKeyCredential("");
EmbeddingsClient client = new EmbeddingsClient(endpoint, credential);
-Response response = client.GetModelInfo();
+Response response = client.GetModelInfo(model: "");
]]>
-
+
This sample shows how to call GetModelInfoAsync and parse the result.
");
AzureKeyCredential credential = new AzureKeyCredential("");
EmbeddingsClient client = new EmbeddingsClient(endpoint, credential);
-Response response = await client.GetModelInfoAsync(null);
+Response response = await client.GetModelInfoAsync(null, null);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("model_name").ToString());
Console.WriteLine(result.GetProperty("model_type").ToString());
Console.WriteLine(result.GetProperty("model_provider_name").ToString());
]]>
-This sample shows how to call GetModelInfoAsync and parse the result.
+This sample shows how to call GetModelInfoAsync with all parameters and parse the result.
");
AzureKeyCredential credential = new AzureKeyCredential("");
EmbeddingsClient client = new EmbeddingsClient(endpoint, credential);
-Response response = await client.GetModelInfoAsync(null);
+Response response = await client.GetModelInfoAsync("", null);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("model_name").ToString());
@@ -68,7 +68,7 @@ Console.WriteLine(result.GetProperty("model_type").ToString());
Console.WriteLine(result.GetProperty("model_provider_name").ToString());
]]>
-
+
This sample shows how to call GetModelInfo and parse the result.
");
AzureKeyCredential credential = new AzureKeyCredential("");
EmbeddingsClient client = new EmbeddingsClient(endpoint, credential);
-Response response = client.GetModelInfo(null);
+Response response = client.GetModelInfo(null, null);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("model_name").ToString());
Console.WriteLine(result.GetProperty("model_type").ToString());
Console.WriteLine(result.GetProperty("model_provider_name").ToString());
]]>
-This sample shows how to call GetModelInfo and parse the result.
+This sample shows how to call GetModelInfo with all parameters and parse the result.
");
AzureKeyCredential credential = new AzureKeyCredential("");
EmbeddingsClient client = new EmbeddingsClient(endpoint, credential);
-Response response = client.GetModelInfo(null);
+Response response = client.GetModelInfo("", null);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("model_name").ToString());
diff --git a/sdk/ai/Azure.AI.Inference/src/Generated/Docs/ImageEmbeddingsClient.xml b/sdk/ai/Azure.AI.Inference/src/Generated/Docs/ImageEmbeddingsClient.xml
index 280a6ad03aa7..52996dbd7b6a 100644
--- a/sdk/ai/Azure.AI.Inference/src/Generated/Docs/ImageEmbeddingsClient.xml
+++ b/sdk/ai/Azure.AI.Inference/src/Generated/Docs/ImageEmbeddingsClient.xml
@@ -1,7 +1,7 @@
-
+
This sample shows how to call GetModelInfoAsync.
response = await client.GetModelInfoAsync();
]]>
-This sample shows how to call GetModelInfoAsync.
+This sample shows how to call GetModelInfoAsync with all parameters.
");
AzureKeyCredential credential = new AzureKeyCredential("");
ImageEmbeddingsClient client = new ImageEmbeddingsClient(endpoint, credential);
-Response response = await client.GetModelInfoAsync();
+Response response = await client.GetModelInfoAsync(model: "");
]]>
-
+
This sample shows how to call GetModelInfo.
response = client.GetModelInfo();
]]>
-This sample shows how to call GetModelInfo.
+This sample shows how to call GetModelInfo with all parameters.
");
AzureKeyCredential credential = new AzureKeyCredential("");
ImageEmbeddingsClient client = new ImageEmbeddingsClient(endpoint, credential);
-Response response = client.GetModelInfo();
+Response response = client.GetModelInfo(model: "");
]]>
-
+
This sample shows how to call GetModelInfoAsync and parse the result.
");
AzureKeyCredential credential = new AzureKeyCredential("");
ImageEmbeddingsClient client = new ImageEmbeddingsClient(endpoint, credential);
-Response response = await client.GetModelInfoAsync(null);
+Response response = await client.GetModelInfoAsync(null, null);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("model_name").ToString());
Console.WriteLine(result.GetProperty("model_type").ToString());
Console.WriteLine(result.GetProperty("model_provider_name").ToString());
]]>
-This sample shows how to call GetModelInfoAsync and parse the result.
+This sample shows how to call GetModelInfoAsync with all parameters and parse the result.
");
AzureKeyCredential credential = new AzureKeyCredential("");
ImageEmbeddingsClient client = new ImageEmbeddingsClient(endpoint, credential);
-Response response = await client.GetModelInfoAsync(null);
+Response response = await client.GetModelInfoAsync("", null);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("model_name").ToString());
@@ -68,7 +68,7 @@ Console.WriteLine(result.GetProperty("model_type").ToString());
Console.WriteLine(result.GetProperty("model_provider_name").ToString());
]]>
-
+
This sample shows how to call GetModelInfo and parse the result.
");
AzureKeyCredential credential = new AzureKeyCredential("");
ImageEmbeddingsClient client = new ImageEmbeddingsClient(endpoint, credential);
-Response response = client.GetModelInfo(null);
+Response response = client.GetModelInfo(null, null);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("model_name").ToString());
Console.WriteLine(result.GetProperty("model_type").ToString());
Console.WriteLine(result.GetProperty("model_provider_name").ToString());
]]>
-This sample shows how to call GetModelInfo and parse the result.
+This sample shows how to call GetModelInfo with all parameters and parse the result.
");
AzureKeyCredential credential = new AzureKeyCredential("");
ImageEmbeddingsClient client = new ImageEmbeddingsClient(endpoint, credential);
-Response response = client.GetModelInfo(null);
+Response response = client.GetModelInfo("", null);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("model_name").ToString());
diff --git a/sdk/ai/Azure.AI.Inference/src/Generated/EmbeddingsClient.cs b/sdk/ai/Azure.AI.Inference/src/Generated/EmbeddingsClient.cs
index 2b2f1bed6a53..2eab5b867a07 100644
--- a/sdk/ai/Azure.AI.Inference/src/Generated/EmbeddingsClient.cs
+++ b/sdk/ai/Azure.AI.Inference/src/Generated/EmbeddingsClient.cs
@@ -20,7 +20,7 @@ public partial class EmbeddingsClient
private const string AuthorizationHeader = "Authorization";
private readonly AzureKeyCredential _keyCredential;
private const string AuthorizationApiKeyPrefix = "Bearer";
- private static readonly string[] AuthorizationScopes = new string[] { "https://ml.azure.com/.default" };
+ private static readonly string[] AuthorizationScopes = new string[] { "https://cognitiveservices.azure.com/.default" };
private readonly TokenCredential _tokenCredential;
private readonly HttpPipeline _pipeline;
private readonly Uri _endpoint;
@@ -75,14 +75,15 @@ public EmbeddingsClient(Uri endpoint, TokenCredential credential, AzureAIInferen
/// Returns information about the AI model.
/// The method makes a REST API call to the `/info` route on the given endpoint.
/// This method will only work when using Serverless API or Managed Compute endpoint.
- /// It will not work for GitHub Models endpoint or Azure OpenAI endpoint.
+ /// It will not work for Azure OpenAI endpoints.
///
+ /// The model deployment name you want information from.
/// The cancellation token to use.
- ///
- public virtual async Task> GetModelInfoAsync(CancellationToken cancellationToken = default)
+ ///
+ public virtual async Task> GetModelInfoAsync(string model = null, CancellationToken cancellationToken = default)
{
RequestContext context = FromCancellationToken(cancellationToken);
- Response response = await GetModelInfoAsync(context).ConfigureAwait(false);
+ Response response = await GetModelInfoAsync(model, context).ConfigureAwait(false);
return Response.FromValue(ModelInfo.FromResponse(response), response);
}
@@ -90,14 +91,15 @@ public virtual async Task> GetModelInfoAsync(CancellationTok
/// Returns information about the AI model.
/// The method makes a REST API call to the `/info` route on the given endpoint.
/// This method will only work when using Serverless API or Managed Compute endpoint.
- /// It will not work for GitHub Models endpoint or Azure OpenAI endpoint.
+ /// It will not work for Azure OpenAI endpoints.
///
+ /// The model deployment name you want information from.
/// The cancellation token to use.
- ///
- public virtual Response GetModelInfo(CancellationToken cancellationToken = default)
+ ///
+ public virtual Response GetModelInfo(string model = null, CancellationToken cancellationToken = default)
{
RequestContext context = FromCancellationToken(cancellationToken);
- Response response = GetModelInfo(context);
+ Response response = GetModelInfo(model, context);
return Response.FromValue(ModelInfo.FromResponse(response), response);
}
@@ -105,7 +107,7 @@ public virtual Response GetModelInfo(CancellationToken cancellationTo
/// [Protocol Method] Returns information about the AI model.
/// The method makes a REST API call to the `/info` route on the given endpoint.
/// This method will only work when using Serverless API or Managed Compute endpoint.
- /// It will not work for GitHub Models endpoint or Azure OpenAI endpoint.
+ /// It will not work for Azure OpenAI endpoints.
///
/// -
///
@@ -114,22 +116,23 @@ public virtual Response GetModelInfo(CancellationToken cancellationTo
///
/// -
///
- /// Please try the simpler convenience overload with strongly typed models first.
+ /// Please try the simpler convenience overload with strongly typed models first.
///
///
///
///
+ /// The model deployment name you want information from.
/// The request context, which can override default behaviors of the client pipeline on a per-call basis.
/// Service returned a non-success status code.
/// The response returned from the service.
- ///
- public virtual async Task GetModelInfoAsync(RequestContext context)
+ ///
+ public virtual async Task GetModelInfoAsync(string model, RequestContext context)
{
using var scope = ClientDiagnostics.CreateScope("EmbeddingsClient.GetModelInfo");
scope.Start();
try
{
- using HttpMessage message = CreateGetModelInfoRequest(context);
+ using HttpMessage message = CreateGetModelInfoRequest(model, context);
return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
}
catch (Exception e)
@@ -143,7 +146,7 @@ public virtual async Task GetModelInfoAsync(RequestContext context)
/// [Protocol Method] Returns information about the AI model.
/// The method makes a REST API call to the `/info` route on the given endpoint.
/// This method will only work when using Serverless API or Managed Compute endpoint.
- /// It will not work for GitHub Models endpoint or Azure OpenAI endpoint.
+ /// It will not work for Azure OpenAI endpoints.
///
/// -
///
@@ -152,22 +155,23 @@ public virtual async Task GetModelInfoAsync(RequestContext context)
///
/// -
///
- /// Please try the simpler convenience overload with strongly typed models first.
+ /// Please try the simpler convenience overload with strongly typed models first.
///
///
///
///
+ /// The model deployment name you want information from.
/// The request context, which can override default behaviors of the client pipeline on a per-call basis.
/// Service returned a non-success status code.
/// The response returned from the service.
- ///
- public virtual Response GetModelInfo(RequestContext context)
+ ///
+ public virtual Response GetModelInfo(string model, RequestContext context)
{
using var scope = ClientDiagnostics.CreateScope("EmbeddingsClient.GetModelInfo");
scope.Start();
try
{
- using HttpMessage message = CreateGetModelInfoRequest(context);
+ using HttpMessage message = CreateGetModelInfoRequest(model, context);
return _pipeline.ProcessMessage(message, context);
}
catch (Exception e)
@@ -197,7 +201,7 @@ internal HttpMessage CreateEmbedRequest(RequestContent content, string extraPara
return message;
}
- internal HttpMessage CreateGetModelInfoRequest(RequestContext context)
+ internal HttpMessage CreateGetModelInfoRequest(string model, RequestContext context)
{
var message = _pipeline.CreateMessage(context, ResponseClassifier200);
var request = message.Request;
@@ -206,6 +210,10 @@ internal HttpMessage CreateGetModelInfoRequest(RequestContext context)
uri.Reset(_endpoint);
uri.AppendPath("/info", false);
uri.AppendQuery("api-version", _apiVersion, true);
+ if (model != null)
+ {
+ uri.AppendQuery("model", model, true);
+ }
request.Uri = uri;
request.Headers.Add("Accept", "application/json");
return message;
diff --git a/sdk/ai/Azure.AI.Inference/src/Generated/ImageEmbeddingsClient.cs b/sdk/ai/Azure.AI.Inference/src/Generated/ImageEmbeddingsClient.cs
index 9bf443cc4dcf..fb67907e0061 100644
--- a/sdk/ai/Azure.AI.Inference/src/Generated/ImageEmbeddingsClient.cs
+++ b/sdk/ai/Azure.AI.Inference/src/Generated/ImageEmbeddingsClient.cs
@@ -20,7 +20,7 @@ public partial class ImageEmbeddingsClient
private const string AuthorizationHeader = "Authorization";
private readonly AzureKeyCredential _keyCredential;
private const string AuthorizationApiKeyPrefix = "Bearer";
- private static readonly string[] AuthorizationScopes = new string[] { "https://ml.azure.com/.default" };
+ private static readonly string[] AuthorizationScopes = new string[] { "https://cognitiveservices.azure.com/.default" };
private readonly TokenCredential _tokenCredential;
private readonly HttpPipeline _pipeline;
private readonly Uri _endpoint;
@@ -75,14 +75,15 @@ public ImageEmbeddingsClient(Uri endpoint, TokenCredential credential, AzureAIIn
/// Returns information about the AI model.
/// The method makes a REST API call to the `/info` route on the given endpoint.
/// This method will only work when using Serverless API or Managed Compute endpoint.
- /// It will not work for GitHub Models endpoint or Azure OpenAI endpoint.
+ /// It will not work for Azure OpenAI endpoints.
///
+ /// The model deployment name you want information from.
/// The cancellation token to use.
- ///
- public virtual async Task> GetModelInfoAsync(CancellationToken cancellationToken = default)
+ ///
+ public virtual async Task> GetModelInfoAsync(string model = null, CancellationToken cancellationToken = default)
{
RequestContext context = FromCancellationToken(cancellationToken);
- Response response = await GetModelInfoAsync(context).ConfigureAwait(false);
+ Response response = await GetModelInfoAsync(model, context).ConfigureAwait(false);
return Response.FromValue(ModelInfo.FromResponse(response), response);
}
@@ -90,14 +91,15 @@ public virtual async Task> GetModelInfoAsync(CancellationTok
/// Returns information about the AI model.
/// The method makes a REST API call to the `/info` route on the given endpoint.
/// This method will only work when using Serverless API or Managed Compute endpoint.
- /// It will not work for GitHub Models endpoint or Azure OpenAI endpoint.
+ /// It will not work for Azure OpenAI endpoints.
///
+ /// The model deployment name you want information from.
/// The cancellation token to use.
- ///
- public virtual Response GetModelInfo(CancellationToken cancellationToken = default)
+ ///
+ public virtual Response GetModelInfo(string model = null, CancellationToken cancellationToken = default)
{
RequestContext context = FromCancellationToken(cancellationToken);
- Response response = GetModelInfo(context);
+ Response response = GetModelInfo(model, context);
return Response.FromValue(ModelInfo.FromResponse(response), response);
}
@@ -105,7 +107,7 @@ public virtual Response GetModelInfo(CancellationToken cancellationTo
/// [Protocol Method] Returns information about the AI model.
/// The method makes a REST API call to the `/info` route on the given endpoint.
/// This method will only work when using Serverless API or Managed Compute endpoint.
- /// It will not work for GitHub Models endpoint or Azure OpenAI endpoint.
+ /// It will not work for Azure OpenAI endpoints.
///
/// -
///
@@ -114,22 +116,23 @@ public virtual Response GetModelInfo(CancellationToken cancellationTo
///
/// -
///
- /// Please try the simpler convenience overload with strongly typed models first.
+ /// Please try the simpler convenience overload with strongly typed models first.
///
///
///
///
+ /// The model deployment name you want information from.
/// The request context, which can override default behaviors of the client pipeline on a per-call basis.
/// Service returned a non-success status code.
/// The response returned from the service.
- ///
- public virtual async Task GetModelInfoAsync(RequestContext context)
+ ///
+ public virtual async Task GetModelInfoAsync(string model, RequestContext context)
{
using var scope = ClientDiagnostics.CreateScope("ImageEmbeddingsClient.GetModelInfo");
scope.Start();
try
{
- using HttpMessage message = CreateGetModelInfoRequest(context);
+ using HttpMessage message = CreateGetModelInfoRequest(model, context);
return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
}
catch (Exception e)
@@ -143,7 +146,7 @@ public virtual async Task GetModelInfoAsync(RequestContext context)
/// [Protocol Method] Returns information about the AI model.
/// The method makes a REST API call to the `/info` route on the given endpoint.
/// This method will only work when using Serverless API or Managed Compute endpoint.
- /// It will not work for GitHub Models endpoint or Azure OpenAI endpoint.
+ /// It will not work for Azure OpenAI endpoints.
///
/// -
///
@@ -152,22 +155,23 @@ public virtual async Task GetModelInfoAsync(RequestContext context)
///
/// -
///
- /// Please try the simpler convenience overload with strongly typed models first.
+ /// Please try the simpler convenience overload with strongly typed models first.
///
///
///
///
+ /// The model deployment name you want information from.
/// The request context, which can override default behaviors of the client pipeline on a per-call basis.
/// Service returned a non-success status code.
/// The response returned from the service.
- ///
- public virtual Response GetModelInfo(RequestContext context)
+ ///
+ public virtual Response GetModelInfo(string model, RequestContext context)
{
using var scope = ClientDiagnostics.CreateScope("ImageEmbeddingsClient.GetModelInfo");
scope.Start();
try
{
- using HttpMessage message = CreateGetModelInfoRequest(context);
+ using HttpMessage message = CreateGetModelInfoRequest(model, context);
return _pipeline.ProcessMessage(message, context);
}
catch (Exception e)
@@ -197,7 +201,7 @@ internal HttpMessage CreateEmbedRequest(RequestContent content, string extraPara
return message;
}
- internal HttpMessage CreateGetModelInfoRequest(RequestContext context)
+ internal HttpMessage CreateGetModelInfoRequest(string model, RequestContext context)
{
var message = _pipeline.CreateMessage(context, ResponseClassifier200);
var request = message.Request;
@@ -206,6 +210,10 @@ internal HttpMessage CreateGetModelInfoRequest(RequestContext context)
uri.Reset(_endpoint);
uri.AppendPath("/info", false);
uri.AppendQuery("api-version", _apiVersion, true);
+ if (model != null)
+ {
+ uri.AppendQuery("model", model, true);
+ }
request.Uri = uri;
request.Headers.Add("Accept", "application/json");
return message;
diff --git a/sdk/ai/Azure.AI.Inference/src/Generated/PromptUsageDetails.Serialization.cs b/sdk/ai/Azure.AI.Inference/src/Generated/PromptUsageDetails.Serialization.cs
new file mode 100644
index 000000000000..f24f05e83c6e
--- /dev/null
+++ b/sdk/ai/Azure.AI.Inference/src/Generated/PromptUsageDetails.Serialization.cs
@@ -0,0 +1,156 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel.Primitives;
+using System.Collections.Generic;
+using System.Text.Json;
+using Azure.Core;
+
+namespace Azure.AI.Inference
+{
+ public partial class PromptUsageDetails : IUtf8JsonSerializable, IJsonModel
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
+
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
+ {
+ writer.WriteStartObject();
+ JsonModelWriteCore(writer, options);
+ writer.WriteEndObject();
+ }
+
+ /// The JSON writer.
+ /// The client options for reading and writing models.
+ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(PromptUsageDetails)} does not support writing '{format}' format.");
+ }
+
+ if (options.Format != "W")
+ {
+ writer.WritePropertyName("audio_tokens"u8);
+ writer.WriteNumberValue(AudioTokens);
+ }
+ if (options.Format != "W")
+ {
+ writer.WritePropertyName("cached_tokens"u8);
+ writer.WriteNumberValue(CachedTokens);
+ }
+ if (options.Format != "W" && _serializedAdditionalRawData != null)
+ {
+ foreach (var item in _serializedAdditionalRawData)
+ {
+ writer.WritePropertyName(item.Key);
+#if NET6_0_OR_GREATER
+ writer.WriteRawValue(item.Value);
+#else
+ using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions))
+ {
+ JsonSerializer.Serialize(writer, document.RootElement);
+ }
+#endif
+ }
+ }
+ }
+
+ PromptUsageDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(PromptUsageDetails)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializePromptUsageDetails(document.RootElement, options);
+ }
+
+ internal static PromptUsageDetails DeserializePromptUsageDetails(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ int audioTokens = default;
+ int cachedTokens = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("audio_tokens"u8))
+ {
+ audioTokens = property.Value.GetInt32();
+ continue;
+ }
+ if (property.NameEquals("cached_tokens"u8))
+ {
+ cachedTokens = property.Value.GetInt32();
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new PromptUsageDetails(audioTokens, cachedTokens, serializedAdditionalRawData);
+ }
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ return ModelReaderWriter.Write(this, options);
+ default:
+ throw new FormatException($"The model {nameof(PromptUsageDetails)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ PromptUsageDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ {
+ using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions);
+ return DeserializePromptUsageDetails(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(PromptUsageDetails)} does not support reading '{options.Format}' format.");
+ }
+ }
+
+ string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static PromptUsageDetails FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions);
+ return DeserializePromptUsageDetails(document.RootElement);
+ }
+
+ /// Convert into a .
+ internal virtual RequestContent ToRequestContent()
+ {
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions);
+ return content;
+ }
+ }
+}
diff --git a/sdk/ai/Azure.AI.Inference/src/Generated/PromptUsageDetails.cs b/sdk/ai/Azure.AI.Inference/src/Generated/PromptUsageDetails.cs
new file mode 100644
index 000000000000..c5da6f3623b1
--- /dev/null
+++ b/sdk/ai/Azure.AI.Inference/src/Generated/PromptUsageDetails.cs
@@ -0,0 +1,69 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+
+namespace Azure.AI.Inference
+{
+ /// A breakdown of tokens used in the prompt/chat history.
+ public partial class PromptUsageDetails
+ {
+ ///
+ /// Keeps track of any properties unknown to the library.
+ ///
+ /// To assign an object to the value of this property use .
+ ///
+ ///
+ /// To assign an already formatted json string to this property use .
+ ///
+ ///
+ /// Examples:
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson("foo")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromString("\"foo\"")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson(new { key = "value" })
+ /// Creates a payload of { "key": "value" }.
+ ///
+ /// -
+ /// BinaryData.FromString("{\"key\": \"value\"}")
+ /// Creates a payload of { "key": "value" }.
+ ///
+ ///
+ ///
+ ///
+ private IDictionary _serializedAdditionalRawData;
+
+ /// Initializes a new instance of .
+ internal PromptUsageDetails()
+ {
+ }
+
+ /// Initializes a new instance of .
+ /// The number of tokens corresponding to audio input.
+ /// The total number of tokens cached.
+ /// Keeps track of any properties unknown to the library.
+ internal PromptUsageDetails(int audioTokens, int cachedTokens, IDictionary serializedAdditionalRawData)
+ {
+ AudioTokens = audioTokens;
+ CachedTokens = cachedTokens;
+ _serializedAdditionalRawData = serializedAdditionalRawData;
+ }
+
+ /// The number of tokens corresponding to audio input.
+ public int AudioTokens { get; }
+ /// The total number of tokens cached.
+ public int CachedTokens { get; }
+ }
+}
diff --git a/sdk/ai/Azure.AI.Inference/src/Generated/StreamingChatResponseMessageUpdate.Serialization.cs b/sdk/ai/Azure.AI.Inference/src/Generated/StreamingChatResponseMessageUpdate.Serialization.cs
index cd6eb8f18aad..f86291cd2e2f 100644
--- a/sdk/ai/Azure.AI.Inference/src/Generated/StreamingChatResponseMessageUpdate.Serialization.cs
+++ b/sdk/ai/Azure.AI.Inference/src/Generated/StreamingChatResponseMessageUpdate.Serialization.cs
@@ -53,6 +53,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit
}
writer.WriteEndArray();
}
+ if (options.Format != "W" && Optional.IsDefined(ReasoningContent))
+ {
+ writer.WritePropertyName("reasoning_content"u8);
+ writer.WriteStringValue(ReasoningContent);
+ }
if (options.Format != "W" && _serializedAdditionalRawData != null)
{
foreach (var item in _serializedAdditionalRawData)
diff --git a/sdk/ai/Azure.AI.Inference/src/Generated/StreamingChatResponseMessageUpdate.cs b/sdk/ai/Azure.AI.Inference/src/Generated/StreamingChatResponseMessageUpdate.cs
index 7d6808846e19..2a7c5972f96b 100644
--- a/sdk/ai/Azure.AI.Inference/src/Generated/StreamingChatResponseMessageUpdate.cs
+++ b/sdk/ai/Azure.AI.Inference/src/Generated/StreamingChatResponseMessageUpdate.cs
@@ -58,12 +58,14 @@ internal StreamingChatResponseMessageUpdate()
/// The tool calls that must be resolved and have their outputs appended to subsequent input messages for the chat
/// completions request to resolve as configured.
///
+ /// The reasoning content the model used for generating the response.
/// Keeps track of any properties unknown to the library.
- internal StreamingChatResponseMessageUpdate(ChatRole? role, string content, IReadOnlyList toolCalls, IDictionary serializedAdditionalRawData)
+ internal StreamingChatResponseMessageUpdate(ChatRole? role, string content, IReadOnlyList toolCalls, string reasoningContent, IDictionary serializedAdditionalRawData)
{
Role = role;
Content = content;
ToolCalls = toolCalls;
+ ReasoningContent = reasoningContent;
_serializedAdditionalRawData = serializedAdditionalRawData;
}
@@ -71,5 +73,7 @@ internal StreamingChatResponseMessageUpdate(ChatRole? role, string content, IRea
public ChatRole? Role { get; }
/// The content of the message.
public string Content { get; }
+ /// The reasoning content the model used for generating the response.
+ public string ReasoningContent { get; }
}
}
diff --git a/sdk/ai/Azure.AI.Inference/tests/Generated/Samples/Samples_ChatCompletionsClient.cs b/sdk/ai/Azure.AI.Inference/tests/Generated/Samples/Samples_ChatCompletionsClient.cs
index b52f3fc3727f..c840c7c6c435 100644
--- a/sdk/ai/Azure.AI.Inference/tests/Generated/Samples/Samples_ChatCompletionsClient.cs
+++ b/sdk/ai/Azure.AI.Inference/tests/Generated/Samples/Samples_ChatCompletionsClient.cs
@@ -17,13 +17,13 @@ public partial class Samples_ChatCompletionsClient
{
[Test]
[Ignore("Only validating compilation of examples")]
- public void Example_Client1_GetModelInfo_MaximumSetModelInformation()
+ public void Example_Client1_GetModelInfo_ShortVersion()
{
Uri endpoint = new Uri("");
AzureKeyCredential credential = new AzureKeyCredential("");
ChatCompletionsClient client = new ChatCompletionsClient(endpoint, credential);
- Response response = client.GetModelInfo(null);
+ Response response = client.GetModelInfo(null, null);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("model_name").ToString());
@@ -33,13 +33,13 @@ public void Example_Client1_GetModelInfo_MaximumSetModelInformation()
[Test]
[Ignore("Only validating compilation of examples")]
- public async Task Example_Client1_GetModelInfo_MaximumSetModelInformation_Async()
+ public async Task Example_Client1_GetModelInfo_ShortVersion_Async()
{
Uri endpoint = new Uri("");
AzureKeyCredential credential = new AzureKeyCredential("");
ChatCompletionsClient client = new ChatCompletionsClient(endpoint, credential);
- Response response = await client.GetModelInfoAsync(null);
+ Response response = await client.GetModelInfoAsync(null, null);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("model_name").ToString());
@@ -49,7 +49,7 @@ public async Task Example_Client1_GetModelInfo_MaximumSetModelInformation_Async(
[Test]
[Ignore("Only validating compilation of examples")]
- public void Example_Client1_GetModelInfo_MaximumSetModelInformation_Convenience()
+ public void Example_Client1_GetModelInfo_ShortVersion_Convenience()
{
Uri endpoint = new Uri("");
AzureKeyCredential credential = new AzureKeyCredential("");
@@ -60,7 +60,7 @@ public void Example_Client1_GetModelInfo_MaximumSetModelInformation_Convenience(
[Test]
[Ignore("Only validating compilation of examples")]
- public async Task Example_Client1_GetModelInfo_MaximumSetModelInformation_Convenience_Async()
+ public async Task Example_Client1_GetModelInfo_ShortVersion_Convenience_Async()
{
Uri endpoint = new Uri("");
AzureKeyCredential credential = new AzureKeyCredential("");
@@ -71,13 +71,13 @@ public async Task Example_Client1_GetModelInfo_MaximumSetModelInformation_Conven
[Test]
[Ignore("Only validating compilation of examples")]
- public void Example_Client1_GetModelInfo_MinimumSetModelInformation()
+ public void Example_Client1_GetModelInfo_AllParameters()
{
Uri endpoint = new Uri("");
AzureKeyCredential credential = new AzureKeyCredential("");
ChatCompletionsClient client = new ChatCompletionsClient(endpoint, credential);
- Response response = client.GetModelInfo(null);
+ Response response = client.GetModelInfo("", null);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("model_name").ToString());
@@ -87,13 +87,13 @@ public void Example_Client1_GetModelInfo_MinimumSetModelInformation()
[Test]
[Ignore("Only validating compilation of examples")]
- public async Task Example_Client1_GetModelInfo_MinimumSetModelInformation_Async()
+ public async Task Example_Client1_GetModelInfo_AllParameters_Async()
{
Uri endpoint = new Uri("");
AzureKeyCredential credential = new AzureKeyCredential("");
ChatCompletionsClient client = new ChatCompletionsClient(endpoint, credential);
- Response response = await client.GetModelInfoAsync(null);
+ Response response = await client.GetModelInfoAsync("", null);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("model_name").ToString());
@@ -103,24 +103,24 @@ public async Task Example_Client1_GetModelInfo_MinimumSetModelInformation_Async(
[Test]
[Ignore("Only validating compilation of examples")]
- public void Example_Client1_GetModelInfo_MinimumSetModelInformation_Convenience()
+ public void Example_Client1_GetModelInfo_AllParameters_Convenience()
{
Uri endpoint = new Uri("");
AzureKeyCredential credential = new AzureKeyCredential("");
ChatCompletionsClient client = new ChatCompletionsClient(endpoint, credential);
- Response response = client.GetModelInfo();
+ Response response = client.GetModelInfo(model: "");
}
[Test]
[Ignore("Only validating compilation of examples")]
- public async Task Example_Client1_GetModelInfo_MinimumSetModelInformation_Convenience_Async()
+ public async Task Example_Client1_GetModelInfo_AllParameters_Convenience_Async()
{
Uri endpoint = new Uri("");
AzureKeyCredential credential = new AzureKeyCredential("");
ChatCompletionsClient client = new ChatCompletionsClient(endpoint, credential);
- Response response = await client.GetModelInfoAsync();
+ Response response = await client.GetModelInfoAsync(model: "");
}
}
}
diff --git a/sdk/ai/Azure.AI.Inference/tests/Generated/Samples/Samples_EmbeddingsClient.cs b/sdk/ai/Azure.AI.Inference/tests/Generated/Samples/Samples_EmbeddingsClient.cs
index a6f43d432014..81aa527263b2 100644
--- a/sdk/ai/Azure.AI.Inference/tests/Generated/Samples/Samples_EmbeddingsClient.cs
+++ b/sdk/ai/Azure.AI.Inference/tests/Generated/Samples/Samples_EmbeddingsClient.cs
@@ -17,13 +17,13 @@ public partial class Samples_EmbeddingsClient
{
[Test]
[Ignore("Only validating compilation of examples")]
- public void Example_Client2_GetModelInfo_MaximumSetModelInformation()
+ public void Example_Client2_GetModelInfo_ShortVersion()
{
Uri endpoint = new Uri("");
AzureKeyCredential credential = new AzureKeyCredential("");
EmbeddingsClient client = new EmbeddingsClient(endpoint, credential);
- Response response = client.GetModelInfo(null);
+ Response response = client.GetModelInfo(null, null);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("model_name").ToString());
@@ -33,13 +33,13 @@ public void Example_Client2_GetModelInfo_MaximumSetModelInformation()
[Test]
[Ignore("Only validating compilation of examples")]
- public async Task Example_Client2_GetModelInfo_MaximumSetModelInformation_Async()
+ public async Task Example_Client2_GetModelInfo_ShortVersion_Async()
{
Uri endpoint = new Uri("");
AzureKeyCredential credential = new AzureKeyCredential("");
EmbeddingsClient client = new EmbeddingsClient(endpoint, credential);
- Response response = await client.GetModelInfoAsync(null);
+ Response response = await client.GetModelInfoAsync(null, null);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("model_name").ToString());
@@ -49,7 +49,7 @@ public async Task Example_Client2_GetModelInfo_MaximumSetModelInformation_Async(
[Test]
[Ignore("Only validating compilation of examples")]
- public void Example_Client2_GetModelInfo_MaximumSetModelInformation_Convenience()
+ public void Example_Client2_GetModelInfo_ShortVersion_Convenience()
{
Uri endpoint = new Uri("");
AzureKeyCredential credential = new AzureKeyCredential("");
@@ -60,7 +60,7 @@ public void Example_Client2_GetModelInfo_MaximumSetModelInformation_Convenience(
[Test]
[Ignore("Only validating compilation of examples")]
- public async Task Example_Client2_GetModelInfo_MaximumSetModelInformation_Convenience_Async()
+ public async Task Example_Client2_GetModelInfo_ShortVersion_Convenience_Async()
{
Uri endpoint = new Uri("");
AzureKeyCredential credential = new AzureKeyCredential("");
@@ -71,13 +71,13 @@ public async Task Example_Client2_GetModelInfo_MaximumSetModelInformation_Conven
[Test]
[Ignore("Only validating compilation of examples")]
- public void Example_Client2_GetModelInfo_MinimumSetModelInformation()
+ public void Example_Client2_GetModelInfo_AllParameters()
{
Uri endpoint = new Uri("");
AzureKeyCredential credential = new AzureKeyCredential("");
EmbeddingsClient client = new EmbeddingsClient(endpoint, credential);
- Response response = client.GetModelInfo(null);
+ Response response = client.GetModelInfo("", null);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("model_name").ToString());
@@ -87,13 +87,13 @@ public void Example_Client2_GetModelInfo_MinimumSetModelInformation()
[Test]
[Ignore("Only validating compilation of examples")]
- public async Task Example_Client2_GetModelInfo_MinimumSetModelInformation_Async()
+ public async Task Example_Client2_GetModelInfo_AllParameters_Async()
{
Uri endpoint = new Uri("");
AzureKeyCredential credential = new AzureKeyCredential("");
EmbeddingsClient client = new EmbeddingsClient(endpoint, credential);
- Response response = await client.GetModelInfoAsync(null);
+ Response response = await client.GetModelInfoAsync("", null);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("model_name").ToString());
@@ -103,24 +103,24 @@ public async Task Example_Client2_GetModelInfo_MinimumSetModelInformation_Async(
[Test]
[Ignore("Only validating compilation of examples")]
- public void Example_Client2_GetModelInfo_MinimumSetModelInformation_Convenience()
+ public void Example_Client2_GetModelInfo_AllParameters_Convenience()
{
Uri endpoint = new Uri("");
AzureKeyCredential credential = new AzureKeyCredential("");
EmbeddingsClient client = new EmbeddingsClient(endpoint, credential);
- Response response = client.GetModelInfo();
+ Response response = client.GetModelInfo(model: "");
}
[Test]
[Ignore("Only validating compilation of examples")]
- public async Task Example_Client2_GetModelInfo_MinimumSetModelInformation_Convenience_Async()
+ public async Task Example_Client2_GetModelInfo_AllParameters_Convenience_Async()
{
Uri endpoint = new Uri("");
AzureKeyCredential credential = new AzureKeyCredential("");
EmbeddingsClient client = new EmbeddingsClient(endpoint, credential);
- Response response = await client.GetModelInfoAsync();
+ Response response = await client.GetModelInfoAsync(model: "");
}
}
}
diff --git a/sdk/ai/Azure.AI.Inference/tests/Generated/Samples/Samples_ImageEmbeddingsClient.cs b/sdk/ai/Azure.AI.Inference/tests/Generated/Samples/Samples_ImageEmbeddingsClient.cs
index 7c068f00b89c..d89f6497306d 100644
--- a/sdk/ai/Azure.AI.Inference/tests/Generated/Samples/Samples_ImageEmbeddingsClient.cs
+++ b/sdk/ai/Azure.AI.Inference/tests/Generated/Samples/Samples_ImageEmbeddingsClient.cs
@@ -17,13 +17,13 @@ public partial class Samples_ImageEmbeddingsClient
{
[Test]
[Ignore("Only validating compilation of examples")]
- public void Example_Client3_GetModelInfo_MaximumSetModelInformation()
+ public void Example_Client3_GetModelInfo_ShortVersion()
{
Uri endpoint = new Uri("");
AzureKeyCredential credential = new AzureKeyCredential("");
ImageEmbeddingsClient client = new ImageEmbeddingsClient(endpoint, credential);
- Response response = client.GetModelInfo(null);
+ Response response = client.GetModelInfo(null, null);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("model_name").ToString());
@@ -33,13 +33,13 @@ public void Example_Client3_GetModelInfo_MaximumSetModelInformation()
[Test]
[Ignore("Only validating compilation of examples")]
- public async Task Example_Client3_GetModelInfo_MaximumSetModelInformation_Async()
+ public async Task Example_Client3_GetModelInfo_ShortVersion_Async()
{
Uri endpoint = new Uri("");
AzureKeyCredential credential = new AzureKeyCredential("");
ImageEmbeddingsClient client = new ImageEmbeddingsClient(endpoint, credential);
- Response response = await client.GetModelInfoAsync(null);
+ Response response = await client.GetModelInfoAsync(null, null);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("model_name").ToString());
@@ -49,7 +49,7 @@ public async Task Example_Client3_GetModelInfo_MaximumSetModelInformation_Async(
[Test]
[Ignore("Only validating compilation of examples")]
- public void Example_Client3_GetModelInfo_MaximumSetModelInformation_Convenience()
+ public void Example_Client3_GetModelInfo_ShortVersion_Convenience()
{
Uri endpoint = new Uri("");
AzureKeyCredential credential = new AzureKeyCredential("");
@@ -60,7 +60,7 @@ public void Example_Client3_GetModelInfo_MaximumSetModelInformation_Convenience(
[Test]
[Ignore("Only validating compilation of examples")]
- public async Task Example_Client3_GetModelInfo_MaximumSetModelInformation_Convenience_Async()
+ public async Task Example_Client3_GetModelInfo_ShortVersion_Convenience_Async()
{
Uri endpoint = new Uri("");
AzureKeyCredential credential = new AzureKeyCredential("");
@@ -71,13 +71,13 @@ public async Task Example_Client3_GetModelInfo_MaximumSetModelInformation_Conven
[Test]
[Ignore("Only validating compilation of examples")]
- public void Example_Client3_GetModelInfo_MinimumSetModelInformation()
+ public void Example_Client3_GetModelInfo_AllParameters()
{
Uri endpoint = new Uri("");
AzureKeyCredential credential = new AzureKeyCredential("");
ImageEmbeddingsClient client = new ImageEmbeddingsClient(endpoint, credential);
- Response response = client.GetModelInfo(null);
+ Response response = client.GetModelInfo("", null);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("model_name").ToString());
@@ -87,13 +87,13 @@ public void Example_Client3_GetModelInfo_MinimumSetModelInformation()
[Test]
[Ignore("Only validating compilation of examples")]
- public async Task Example_Client3_GetModelInfo_MinimumSetModelInformation_Async()
+ public async Task Example_Client3_GetModelInfo_AllParameters_Async()
{
Uri endpoint = new Uri("");
AzureKeyCredential credential = new AzureKeyCredential("");
ImageEmbeddingsClient client = new ImageEmbeddingsClient(endpoint, credential);
- Response response = await client.GetModelInfoAsync(null);
+ Response response = await client.GetModelInfoAsync("", null);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("model_name").ToString());
@@ -103,24 +103,24 @@ public async Task Example_Client3_GetModelInfo_MinimumSetModelInformation_Async(
[Test]
[Ignore("Only validating compilation of examples")]
- public void Example_Client3_GetModelInfo_MinimumSetModelInformation_Convenience()
+ public void Example_Client3_GetModelInfo_AllParameters_Convenience()
{
Uri endpoint = new Uri("");
AzureKeyCredential credential = new AzureKeyCredential("");
ImageEmbeddingsClient client = new ImageEmbeddingsClient(endpoint, credential);
- Response response = client.GetModelInfo();
+ Response response = client.GetModelInfo(model: "");
}
[Test]
[Ignore("Only validating compilation of examples")]
- public async Task Example_Client3_GetModelInfo_MinimumSetModelInformation_Convenience_Async()
+ public async Task Example_Client3_GetModelInfo_AllParameters_Convenience_Async()
{
Uri endpoint = new Uri("");
AzureKeyCredential credential = new AzureKeyCredential("");
ImageEmbeddingsClient client = new ImageEmbeddingsClient(endpoint, credential);
- Response response = await client.GetModelInfoAsync();
+ Response response = await client.GetModelInfoAsync(model: "");
}
}
}
diff --git a/sdk/ai/Azure.AI.Inference/tsp-location.yaml b/sdk/ai/Azure.AI.Inference/tsp-location.yaml
index 84d0451aecc0..0cc0fb9d1f8d 100644
--- a/sdk/ai/Azure.AI.Inference/tsp-location.yaml
+++ b/sdk/ai/Azure.AI.Inference/tsp-location.yaml
@@ -1,3 +1,4 @@
directory: specification/ai/ModelClient
+commit: caee61180367b726db470989a36ee57837825a37
repo: Azure/azure-rest-api-specs
-commit: 9524584541371b1fc89720e9325332f52f850e70
+additionalDirectories: