diff --git a/.vscode/cspell.json b/.vscode/cspell.json
index 5ae22094a0d3..cf37ff5c2057 100644
--- a/.vscode/cspell.json
+++ b/.vscode/cspell.json
@@ -34,6 +34,7 @@
"*.user",
".vscode/cspell.json",
"assets.json",
+ "eng/Packages.Data.props",
"sdk/confidentialledger/Azure.Security.CodeTransparency/tests/TestFiles/*",
// These services are opted out of public API surface spell checking.
// Spelling issues must be addressed before adding these back in.
@@ -48,6 +49,7 @@
"sdk/modelsrepository/*/api/*.cs",
"sdk/monitor/Azure.ResourceManager.Monitor/api/*.cs",
"sdk/objectanchors/*/api/*.cs",
+ "sdk/openai/Azure.AI.OpenAI/tests/Assets/playback_test_config.json",
"sdk/purview/*/api/*.cs",
"sdk/remoterendering/*/api/*.cs",
"sdk/videoanalyzer/*/api/*.cs",
@@ -975,6 +977,25 @@
"ipfix"
]
},
+ {
+ "filename": "**/sdk/openai/**/*",
+ "words": [
+ "AOAI",
+ "Arrr",
+ "Dall",
+ "Dalle",
+ "Dall-E",
+ "devcert",
+ "Filip",
+ "Filip's",
+ "granularities",
+ "haikus",
+ "msdocs",
+ "OpenAI",
+ "Pavleski",
+ "Tekakwitha"
+ ]
+ },
{
"filename": "**/sdk/operationalinsights/**/*.cs",
"words": [
diff --git a/eng/Packages.Data.props b/eng/Packages.Data.props
index 1395d0b59b9c..bfa73b61bdca 100644
--- a/eng/Packages.Data.props
+++ b/eng/Packages.Data.props
@@ -86,7 +86,7 @@
-
+
@@ -157,7 +157,7 @@
@@ -179,7 +179,7 @@
-
+
-
+
diff --git a/sdk/openai/Azure.AI.OpenAI/README.md b/sdk/openai/Azure.AI.OpenAI/README.md
index 703467a165ad..c1ac19120c87 100644
--- a/sdk/openai/Azure.AI.OpenAI/README.md
+++ b/sdk/openai/Azure.AI.OpenAI/README.md
@@ -157,7 +157,7 @@ ChatCompletion completion = chatClient.CompleteChat(
[
// System messages represent instructions or other guidance about how the assistant should behave
new SystemChatMessage("You are a helpful assistant that talks like a pirate."),
- // User messages represent user input, whether historical or the most recen tinput
+ // User messages represent user input, whether historical or the most recent input
new UserChatMessage("Hi, can you help me?"),
// Assistant messages in a request represent conversation history for responses
new AssistantChatMessage("Arrr! Of course, me hearty! What can I do for ye?"),
@@ -362,7 +362,9 @@ foreach (KeyValuePair indexToIdPair in toolCallIdsByIndex)
functionArgumentBuildersByIndex[indexToIdPair.Key].ToString()));
}
-conversationMessages.Add(new AssistantChatMessage(toolCalls, contentBuilder.ToString()));
+var assistantChatMessage = new AssistantChatMessage(toolCalls);
+assistantChatMessage.Content.Add(ChatMessageContentPart.CreateTextPart(contentBuilder.ToString()));
+conversationMessages.Add(assistantChatMessage);
// Placeholder: each tool call must be resolved, like in the non-streaming case
string GetToolCallOutput(ChatToolCall toolCall) => null;
@@ -526,11 +528,11 @@ This project has adopted the [Microsoft Open Source Code of Conduct][code_of_con
[azure_openai_client_class]: https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/openai/Azure.AI.OpenAI/src/Custom/AzureOpenAIClient.cs
[openai_rest]: https://learn.microsoft.com/azure/cognitive-services/openai/reference
[azure_openai_completions_docs]: https://learn.microsoft.com/azure/cognitive-services/openai/how-to/completions
-[azure_openai_embeddgings_docs]: https://learn.microsoft.com/azure/cognitive-services/openai/concepts/understand-embeddings
+[azure_openai_embeddings_docs]: https://learn.microsoft.com/azure/cognitive-services/openai/concepts/understand-embeddings
[openai_contrib]: https://github.com/Azure/azure-sdk-for-net/blob/main/CONTRIBUTING.md
[cla]: https://cla.microsoft.com
[code_of_conduct]: https://opensource.microsoft.com/codeofconduct/
[code_of_conduct_faq]: https://opensource.microsoft.com/codeofconduct/faq/
[email_opencode]: mailto:opencode@microsoft.com
-
\ No newline at end of file
+
diff --git a/sdk/openai/Azure.AI.OpenAI/api/Azure.AI.OpenAI.netstandard2.0.cs b/sdk/openai/Azure.AI.OpenAI/api/Azure.AI.OpenAI.netstandard2.0.cs
index 2a47a4534fee..d1ecd92f305a 100644
--- a/sdk/openai/Azure.AI.OpenAI/api/Azure.AI.OpenAI.netstandard2.0.cs
+++ b/sdk/openai/Azure.AI.OpenAI/api/Azure.AI.OpenAI.netstandard2.0.cs
@@ -1,21 +1,5 @@
namespace Azure.AI.OpenAI
{
- public static partial class AzureChatCompletionExtensions
- {
- public static Azure.AI.OpenAI.Chat.AzureChatMessageContext GetAzureMessageContext(this OpenAI.Chat.ChatCompletion chatCompletion) { throw null; }
- public static Azure.AI.OpenAI.ContentFilterResultForPrompt GetContentFilterResultForPrompt(this OpenAI.Chat.ChatCompletion chatCompletion) { throw null; }
- public static Azure.AI.OpenAI.ContentFilterResultForResponse GetContentFilterResultForResponse(this OpenAI.Chat.ChatCompletion chatCompletion) { throw null; }
- }
- public static partial class AzureChatCompletionOptionsExtensions
- {
- public static void AddDataSource(this OpenAI.Chat.ChatCompletionOptions options, Azure.AI.OpenAI.Chat.AzureChatDataSource dataSource) { }
- public static System.Collections.Generic.IReadOnlyList GetDataSources(this OpenAI.Chat.ChatCompletionOptions options) { throw null; }
- }
- public static partial class AzureGeneratedImageExtensions
- {
- public static Azure.AI.OpenAI.ImageContentFilterResultForPrompt GetContentFilterResultForPrompt(this OpenAI.Images.GeneratedImage image) { throw null; }
- public static Azure.AI.OpenAI.ImageContentFilterResultForResponse GetContentFilterResultForResponse(this OpenAI.Images.GeneratedImage image) { throw null; }
- }
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public readonly partial struct AzureOpenAIAudience : System.IEquatable
{
@@ -62,7 +46,7 @@ public AzureOpenAIClient(System.Uri endpoint, System.ClientModel.ApiKeyCredentia
}
public partial class AzureOpenAIClientOptions : System.ClientModel.Primitives.ClientPipelineOptions
{
- public AzureOpenAIClientOptions(Azure.AI.OpenAI.AzureOpenAIClientOptions.ServiceVersion version = Azure.AI.OpenAI.AzureOpenAIClientOptions.ServiceVersion.V2024_07_01_Preview) { }
+ public AzureOpenAIClientOptions(Azure.AI.OpenAI.AzureOpenAIClientOptions.ServiceVersion version = Azure.AI.OpenAI.AzureOpenAIClientOptions.ServiceVersion.V2024_08_01_Preview) { }
public string ApplicationId { get { throw null; } set { } }
public Azure.AI.OpenAI.AzureOpenAIAudience? Audience { get { throw null; } set { } }
public enum ServiceVersion
@@ -71,14 +55,9 @@ public enum ServiceVersion
V2024_05_01_Preview = 8,
V2024_06_01 = 9,
V2024_07_01_Preview = 10,
+ V2024_08_01_Preview = 11,
}
}
- public static partial class AzureStreamingChatCompletionUpdateExtensions
- {
- public static Azure.AI.OpenAI.Chat.AzureChatMessageContext GetAzureMessageContext(this OpenAI.Chat.StreamingChatCompletionUpdate chatUpdate) { throw null; }
- public static Azure.AI.OpenAI.ContentFilterResultForPrompt GetContentFilterResultForPrompt(this OpenAI.Chat.StreamingChatCompletionUpdate chatUpdate) { throw null; }
- public static Azure.AI.OpenAI.ContentFilterResultForResponse GetContentFilterResultForResponse(this OpenAI.Chat.StreamingChatCompletionUpdate chatUpdate) { throw null; }
- }
public partial class ContentFilterBlocklistResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel
{
internal ContentFilterBlocklistResult() { }
@@ -124,40 +103,6 @@ internal ContentFilterProtectedMaterialResult() { }
string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
}
- public partial class ContentFilterResultForPrompt : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel
- {
- internal ContentFilterResultForPrompt() { }
- public Azure.AI.OpenAI.ContentFilterBlocklistResult CustomBlocklists { get { throw null; } }
- public Azure.AI.OpenAI.ContentFilterSeverityResult Hate { get { throw null; } }
- public Azure.AI.OpenAI.ContentFilterDetectionResult IndirectAttack { get { throw null; } }
- public Azure.AI.OpenAI.ContentFilterDetectionResult Jailbreak { get { throw null; } }
- public Azure.AI.OpenAI.ContentFilterDetectionResult Profanity { get { throw null; } }
- public Azure.AI.OpenAI.ContentFilterSeverityResult SelfHarm { get { throw null; } }
- public Azure.AI.OpenAI.ContentFilterSeverityResult Sexual { get { throw null; } }
- public Azure.AI.OpenAI.ContentFilterSeverityResult Violence { get { throw null; } }
- Azure.AI.OpenAI.ContentFilterResultForPrompt System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
- void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { }
- Azure.AI.OpenAI.ContentFilterResultForPrompt System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
- string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
- System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
- }
- public partial class ContentFilterResultForResponse : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel
- {
- internal ContentFilterResultForResponse() { }
- public Azure.AI.OpenAI.ContentFilterBlocklistResult CustomBlocklists { get { throw null; } }
- public Azure.AI.OpenAI.ContentFilterSeverityResult Hate { get { throw null; } }
- public Azure.AI.OpenAI.ContentFilterDetectionResult Profanity { get { throw null; } }
- public Azure.AI.OpenAI.ContentFilterProtectedMaterialResult ProtectedMaterialCode { get { throw null; } }
- public Azure.AI.OpenAI.ContentFilterDetectionResult ProtectedMaterialText { get { throw null; } }
- public Azure.AI.OpenAI.ContentFilterSeverityResult SelfHarm { get { throw null; } }
- public Azure.AI.OpenAI.ContentFilterSeverityResult Sexual { get { throw null; } }
- public Azure.AI.OpenAI.ContentFilterSeverityResult Violence { get { throw null; } }
- Azure.AI.OpenAI.ContentFilterResultForResponse System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
- void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { }
- Azure.AI.OpenAI.ContentFilterResultForResponse System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
- string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
- System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
- }
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public readonly partial struct ContentFilterSeverity : System.IEquatable
{
@@ -189,30 +134,64 @@ internal ContentFilterSeverityResult() { }
string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
}
- public partial class ImageContentFilterResultForPrompt : Azure.AI.OpenAI.ImageContentFilterResultForResponse, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel
+ public partial class RequestContentFilterResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel
+ {
+ internal RequestContentFilterResult() { }
+ public Azure.AI.OpenAI.ContentFilterBlocklistResult CustomBlocklists { get { throw null; } }
+ public Azure.AI.OpenAI.ContentFilterSeverityResult Hate { get { throw null; } }
+ public Azure.AI.OpenAI.ContentFilterDetectionResult IndirectAttack { get { throw null; } }
+ public Azure.AI.OpenAI.ContentFilterDetectionResult Jailbreak { get { throw null; } }
+ public Azure.AI.OpenAI.ContentFilterDetectionResult Profanity { get { throw null; } }
+ public Azure.AI.OpenAI.ContentFilterSeverityResult SelfHarm { get { throw null; } }
+ public Azure.AI.OpenAI.ContentFilterSeverityResult Sexual { get { throw null; } }
+ public Azure.AI.OpenAI.ContentFilterSeverityResult Violence { get { throw null; } }
+ Azure.AI.OpenAI.RequestContentFilterResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
+ void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { }
+ Azure.AI.OpenAI.RequestContentFilterResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
+ string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
+ System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
+ }
+ public partial class RequestImageContentFilterResult : Azure.AI.OpenAI.ResponseImageContentFilterResult, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel
{
- internal ImageContentFilterResultForPrompt() { }
+ internal RequestImageContentFilterResult() { }
public Azure.AI.OpenAI.ContentFilterBlocklistResult CustomBlocklists { get { throw null; } }
public Azure.AI.OpenAI.ContentFilterDetectionResult Jailbreak { get { throw null; } }
public Azure.AI.OpenAI.ContentFilterDetectionResult Profanity { get { throw null; } }
- Azure.AI.OpenAI.ImageContentFilterResultForPrompt System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
- void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { }
- Azure.AI.OpenAI.ImageContentFilterResultForPrompt System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
- string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
- System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
+ Azure.AI.OpenAI.RequestImageContentFilterResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
+ void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { }
+ Azure.AI.OpenAI.RequestImageContentFilterResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
+ string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
+ System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
}
- public partial class ImageContentFilterResultForResponse : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel
+ public partial class ResponseContentFilterResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel
{
- internal ImageContentFilterResultForResponse() { }
+ internal ResponseContentFilterResult() { }
+ public Azure.AI.OpenAI.ContentFilterBlocklistResult CustomBlocklists { get { throw null; } }
+ public Azure.AI.OpenAI.ContentFilterSeverityResult Hate { get { throw null; } }
+ public Azure.AI.OpenAI.ContentFilterDetectionResult Profanity { get { throw null; } }
+ public Azure.AI.OpenAI.ContentFilterProtectedMaterialResult ProtectedMaterialCode { get { throw null; } }
+ public Azure.AI.OpenAI.ContentFilterDetectionResult ProtectedMaterialText { get { throw null; } }
+ public Azure.AI.OpenAI.ContentFilterSeverityResult SelfHarm { get { throw null; } }
+ public Azure.AI.OpenAI.ContentFilterSeverityResult Sexual { get { throw null; } }
+ public Azure.AI.OpenAI.ContentFilterSeverityResult Violence { get { throw null; } }
+ Azure.AI.OpenAI.ResponseContentFilterResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
+ void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { }
+ Azure.AI.OpenAI.ResponseContentFilterResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
+ string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
+ System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
+ }
+ public partial class ResponseImageContentFilterResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel
+ {
+ internal ResponseImageContentFilterResult() { }
public Azure.AI.OpenAI.ContentFilterSeverityResult Hate { get { throw null; } }
public Azure.AI.OpenAI.ContentFilterSeverityResult SelfHarm { get { throw null; } }
public Azure.AI.OpenAI.ContentFilterSeverityResult Sexual { get { throw null; } }
public Azure.AI.OpenAI.ContentFilterSeverityResult Violence { get { throw null; } }
- Azure.AI.OpenAI.ImageContentFilterResultForResponse System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
- void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { }
- Azure.AI.OpenAI.ImageContentFilterResultForResponse System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
- string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
- System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
+ Azure.AI.OpenAI.ResponseImageContentFilterResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
+ void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { }
+ Azure.AI.OpenAI.ResponseImageContentFilterResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
+ string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
+ System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
}
}
namespace Azure.AI.OpenAI.Chat
@@ -223,6 +202,7 @@ internal AzureChatCitation() { }
public string ChunkId { get { throw null; } }
public string Content { get { throw null; } }
public string Filepath { get { throw null; } }
+ public double? RerankScore { get { throw null; } }
public string Title { get { throw null; } }
public string Url { get { throw null; } }
Azure.AI.OpenAI.Chat.AzureChatCitation System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
@@ -231,6 +211,17 @@ internal AzureChatCitation() { }
string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
}
+ public static partial class AzureChatCompletionExtensions
+ {
+ public static Azure.AI.OpenAI.Chat.AzureChatMessageContext GetAzureMessageContext(this OpenAI.Chat.ChatCompletion chatCompletion) { throw null; }
+ public static Azure.AI.OpenAI.RequestContentFilterResult GetRequestContentFilterResult(this OpenAI.Chat.ChatCompletion chatCompletion) { throw null; }
+ public static Azure.AI.OpenAI.ResponseContentFilterResult GetResponseContentFilterResult(this OpenAI.Chat.ChatCompletion chatCompletion) { throw null; }
+ }
+ public static partial class AzureChatCompletionOptionsExtensions
+ {
+ public static void AddDataSource(this OpenAI.Chat.ChatCompletionOptions options, Azure.AI.OpenAI.Chat.AzureChatDataSource dataSource) { }
+ public static System.Collections.Generic.IReadOnlyList GetDataSources(this OpenAI.Chat.ChatCompletionOptions options) { throw null; }
+ }
public abstract partial class AzureChatDataSource : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel
{
protected AzureChatDataSource() { }
@@ -301,8 +292,7 @@ public AzureCosmosDBChatDataSource() { }
public string IndexName { get { throw null; } set { } }
public bool? InScope { get { throw null; } set { } }
public int? MaxSearchQueries { get { throw null; } set { } }
- public Azure.AI.OpenAI.Chat.DataSourceOutputContextFlags? OutputContextFlags { get { throw null; } set { } }
- public string RoleInformation { get { throw null; } set { } }
+ public Azure.AI.OpenAI.Chat.DataSourceOutputContexts? OutputContextFlags { get { throw null; } set { } }
public int? Strictness { get { throw null; } set { } }
public int? TopNDocuments { get { throw null; } set { } }
public Azure.AI.OpenAI.Chat.DataSourceVectorizer VectorizationSource { get { throw null; } set { } }
@@ -312,28 +302,6 @@ public AzureCosmosDBChatDataSource() { }
string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
}
- public partial class AzureMachineLearningIndexChatDataSource : Azure.AI.OpenAI.Chat.AzureChatDataSource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel
- {
- [System.ObsoleteAttribute("Constructors of types with required members are not supported in this version of your compiler.", true)]
- public AzureMachineLearningIndexChatDataSource() { }
- public bool? AllowPartialResult { get { throw null; } set { } }
- public Azure.AI.OpenAI.Chat.DataSourceAuthentication Authentication { get { throw null; } set { } }
- public string Filter { get { throw null; } set { } }
- public string IndexName { get { throw null; } set { } }
- public bool? InScope { get { throw null; } set { } }
- public int? MaxSearchQueries { get { throw null; } set { } }
- public Azure.AI.OpenAI.Chat.DataSourceOutputContextFlags? OutputContextFlags { get { throw null; } set { } }
- public string ProjectResourceId { get { throw null; } set { } }
- public string RoleInformation { get { throw null; } set { } }
- public int? Strictness { get { throw null; } set { } }
- public int? TopNDocuments { get { throw null; } set { } }
- public string Version { get { throw null; } set { } }
- Azure.AI.OpenAI.Chat.AzureMachineLearningIndexChatDataSource System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
- void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { }
- Azure.AI.OpenAI.Chat.AzureMachineLearningIndexChatDataSource System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
- string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
- System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
- }
public partial class AzureSearchChatDataSource : Azure.AI.OpenAI.Chat.AzureChatDataSource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel
{
[System.ObsoleteAttribute("Constructors of types with required members are not supported in this version of your compiler.", true)]
@@ -346,9 +314,8 @@ public AzureSearchChatDataSource() { }
public string IndexName { get { throw null; } set { } }
public bool? InScope { get { throw null; } set { } }
public int? MaxSearchQueries { get { throw null; } set { } }
- public Azure.AI.OpenAI.Chat.DataSourceOutputContextFlags? OutputContextFlags { get { throw null; } set { } }
+ public Azure.AI.OpenAI.Chat.DataSourceOutputContexts? OutputContextFlags { get { throw null; } set { } }
public Azure.AI.OpenAI.Chat.DataSourceQueryType? QueryType { get { throw null; } set { } }
- public string RoleInformation { get { throw null; } set { } }
public string SemanticConfiguration { get { throw null; } set { } }
public int? Strictness { get { throw null; } set { } }
public int? TopNDocuments { get { throw null; } set { } }
@@ -359,6 +326,12 @@ public AzureSearchChatDataSource() { }
string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
}
+ public static partial class AzureStreamingChatCompletionUpdateExtensions
+ {
+ public static Azure.AI.OpenAI.Chat.AzureChatMessageContext GetAzureMessageContext(this OpenAI.Chat.StreamingChatCompletionUpdate chatUpdate) { throw null; }
+ public static Azure.AI.OpenAI.RequestContentFilterResult GetRequestContentFilterResult(this OpenAI.Chat.StreamingChatCompletionUpdate chatUpdate) { throw null; }
+ public static Azure.AI.OpenAI.ResponseContentFilterResult GetResponseContentFilterResult(this OpenAI.Chat.StreamingChatCompletionUpdate chatUpdate) { throw null; }
+ }
public abstract partial class DataSourceAuthentication : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel
{
protected DataSourceAuthentication() { }
@@ -369,6 +342,7 @@ protected DataSourceAuthentication() { }
public static Azure.AI.OpenAI.Chat.DataSourceAuthentication FromKeyAndKeyId(string key, string keyId) { throw null; }
public static Azure.AI.OpenAI.Chat.DataSourceAuthentication FromSystemManagedIdentity() { throw null; }
public static Azure.AI.OpenAI.Chat.DataSourceAuthentication FromUserManagedIdentity(string identityResourceId) { throw null; }
+ public static Azure.AI.OpenAI.Chat.DataSourceAuthentication FromUsernameAndPassword(string username, string password) { throw null; }
Azure.AI.OpenAI.Chat.DataSourceAuthentication System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { }
Azure.AI.OpenAI.Chat.DataSourceAuthentication System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
@@ -392,7 +366,7 @@ public DataSourceFieldMappings() { }
System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
}
[System.FlagsAttribute]
- public enum DataSourceOutputContextFlags
+ public enum DataSourceOutputContexts
{
Intent = 1,
Citations = 2,
@@ -424,6 +398,7 @@ public abstract partial class DataSourceVectorizer : System.ClientModel.Primitiv
protected DataSourceVectorizer() { }
public static Azure.AI.OpenAI.Chat.DataSourceVectorizer FromDeploymentName(string deploymentName) { throw null; }
public static Azure.AI.OpenAI.Chat.DataSourceVectorizer FromEndpoint(System.Uri endpoint, Azure.AI.OpenAI.Chat.DataSourceAuthentication authentication) { throw null; }
+ public static Azure.AI.OpenAI.Chat.DataSourceVectorizer FromIntegratedResource() { throw null; }
public static Azure.AI.OpenAI.Chat.DataSourceVectorizer FromModelId(string modelId) { throw null; }
Azure.AI.OpenAI.Chat.DataSourceVectorizer System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { }
@@ -442,9 +417,8 @@ public ElasticsearchChatDataSource() { }
public string IndexName { get { throw null; } set { } }
public bool? InScope { get { throw null; } set { } }
public int? MaxSearchQueries { get { throw null; } set { } }
- public Azure.AI.OpenAI.Chat.DataSourceOutputContextFlags? OutputContextFlags { get { throw null; } set { } }
+ public Azure.AI.OpenAI.Chat.DataSourceOutputContexts? OutputContextFlags { get { throw null; } set { } }
public Azure.AI.OpenAI.Chat.DataSourceQueryType? QueryType { get { throw null; } set { } }
- public string RoleInformation { get { throw null; } set { } }
public int? Strictness { get { throw null; } set { } }
public int? TopNDocuments { get { throw null; } set { } }
public Azure.AI.OpenAI.Chat.DataSourceVectorizer VectorizationSource { get { throw null; } set { } }
@@ -454,6 +428,28 @@ public ElasticsearchChatDataSource() { }
string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
}
+ public partial class MongoDBChatDataSource : Azure.AI.OpenAI.Chat.AzureChatDataSource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel
+ {
+ [System.ObsoleteAttribute("Constructors of types with required members are not supported in this version of your compiler.", true)]
+ public MongoDBChatDataSource() { }
+ public bool? AllowPartialResult { get { throw null; } set { } }
+ public string AppName { get { throw null; } set { } }
+ public Azure.AI.OpenAI.Chat.DataSourceAuthentication Authentication { get { throw null; } set { } }
+ public string CollectionName { get { throw null; } set { } }
+ public string EndpointName { get { throw null; } set { } }
+ public string IndexName { get { throw null; } set { } }
+ public bool? InScope { get { throw null; } set { } }
+ public int? MaxSearchQueries { get { throw null; } set { } }
+ public Azure.AI.OpenAI.Chat.DataSourceOutputContexts? OutputContextFlags { get { throw null; } set { } }
+ public int? Strictness { get { throw null; } set { } }
+ public int? TopNDocuments { get { throw null; } set { } }
+ public Azure.AI.OpenAI.Chat.DataSourceVectorizer VectorizationSource { get { throw null; } set { } }
+ Azure.AI.OpenAI.Chat.MongoDBChatDataSource System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
+ void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { }
+ Azure.AI.OpenAI.Chat.MongoDBChatDataSource System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
+ string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
+ System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
+ }
public partial class PineconeChatDataSource : Azure.AI.OpenAI.Chat.AzureChatDataSource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel
{
[System.ObsoleteAttribute("Constructors of types with required members are not supported in this version of your compiler.", true)]
@@ -465,8 +461,7 @@ public PineconeChatDataSource() { }
public string IndexName { get { throw null; } set { } }
public bool? InScope { get { throw null; } set { } }
public int? MaxSearchQueries { get { throw null; } set { } }
- public Azure.AI.OpenAI.Chat.DataSourceOutputContextFlags? OutputContextFlags { get { throw null; } set { } }
- public string RoleInformation { get { throw null; } set { } }
+ public Azure.AI.OpenAI.Chat.DataSourceOutputContexts? OutputContextFlags { get { throw null; } set { } }
public int? Strictness { get { throw null; } set { } }
public int? TopNDocuments { get { throw null; } set { } }
public Azure.AI.OpenAI.Chat.DataSourceVectorizer VectorizationSource { get { throw null; } set { } }
@@ -477,3 +472,11 @@ public PineconeChatDataSource() { }
System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
}
}
+namespace Azure.AI.OpenAI.Images
+{
+ public static partial class AzureGeneratedImageExtensions
+ {
+ public static Azure.AI.OpenAI.RequestImageContentFilterResult GetRequestContentFilterResult(this OpenAI.Images.GeneratedImage image) { throw null; }
+ public static Azure.AI.OpenAI.ResponseImageContentFilterResult GetResponseContentFilterResult(this OpenAI.Images.GeneratedImage image) { throw null; }
+ }
+}
diff --git a/sdk/openai/Azure.AI.OpenAI/assets.json b/sdk/openai/Azure.AI.OpenAI/assets.json
index 39d86235b486..d4627c89fd84 100644
--- a/sdk/openai/Azure.AI.OpenAI/assets.json
+++ b/sdk/openai/Azure.AI.OpenAI/assets.json
@@ -2,5 +2,5 @@
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "net",
"TagPrefix": "net/openai/Azure.AI.OpenAI",
- "Tag": "net/openai/Azure.AI.OpenAI_23ae923738"
+ "Tag": "net/openai/Azure.AI.OpenAI_39ae840db6"
}
diff --git a/sdk/openai/Azure.AI.OpenAI/src/Azure.AI.OpenAI.csproj b/sdk/openai/Azure.AI.OpenAI/src/Azure.AI.OpenAI.csproj
index b8070ffcf523..fb573d3a2181 100644
--- a/sdk/openai/Azure.AI.OpenAI/src/Azure.AI.OpenAI.csproj
+++ b/sdk/openai/Azure.AI.OpenAI/src/Azure.AI.OpenAI.csproj
@@ -37,10 +37,7 @@
-
-
-
-
+
@@ -56,13 +53,11 @@
-
-
-
+
diff --git a/sdk/openai/Azure.AI.OpenAI/src/Custom/Assistants/AzureAssistantClient.Protocol.cs b/sdk/openai/Azure.AI.OpenAI/src/Custom/Assistants/AzureAssistantClient.Protocol.cs
index c1c987098677..236a54231198 100644
--- a/sdk/openai/Azure.AI.OpenAI/src/Custom/Assistants/AzureAssistantClient.Protocol.cs
+++ b/sdk/openai/Azure.AI.OpenAI/src/Custom/Assistants/AzureAssistantClient.Protocol.cs
@@ -4,6 +4,7 @@
using System.ClientModel;
using System.ClientModel.Primitives;
using System.Diagnostics.CodeAnalysis;
+using Azure.AI.OpenAI.Utility;
namespace Azure.AI.OpenAI.Assistants;
@@ -26,16 +27,25 @@ public override ClientResult CreateAssistant(BinaryContent content, RequestOptio
return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options));
}
- public override IAsyncEnumerable GetAssistantsAsync(int? limit, string order, string after, string before, RequestOptions options)
+ public override AsyncCollectionResult GetAssistantsAsync(int? limit, string order, string after, string before, RequestOptions options)
{
- AzureAssistantsPageEnumerator enumerator = new(Pipeline, _endpoint, limit, order, after, before, _apiVersion, options);
- return PageCollectionHelpers.CreateAsync(enumerator);
+ return new AzureAsyncCollectionResult(
+ Pipeline,
+ options,
+ continuation => CreateGetAssistantsRequest(limit, order, continuation?.After ?? after, continuation?.Before ?? before, options),
+ page => AssistantCollectionPageToken.FromResponse(page, limit, order, before),
+ page => ModelReaderWriter.Read(page.GetRawResponse().Content).Data,
+ options?.CancellationToken ?? default);
}
- public override IEnumerable GetAssistants(int? limit, string order, string after, string before, RequestOptions options)
+ public override CollectionResult GetAssistants(int? limit, string order, string after, string before, RequestOptions options)
{
- AzureAssistantsPageEnumerator enumerator = new(Pipeline, _endpoint, limit, order, after, before, _apiVersion, options);
- return PageCollectionHelpers.Create(enumerator);
+ return new AzureCollectionResult(
+ Pipeline,
+ options,
+ continuation => CreateGetAssistantsRequest(limit, order, continuation?.After ?? after, continuation?.Before ?? before, options),
+ page => AssistantCollectionPageToken.FromResponse(page, limit, order, before),
+ page => ModelReaderWriter.Read(page.GetRawResponse().Content).Data);
}
public override async Task GetAssistantAsync(string assistantId, RequestOptions options)
@@ -107,20 +117,27 @@ public override ClientResult CreateMessage(string threadId, BinaryContent conten
}
///
- public override IAsyncEnumerable GetMessagesAsync(string threadId, int? limit, string order, string after, string before, RequestOptions options)
+ public override AsyncCollectionResult GetMessagesAsync(string threadId, int? limit, string order, string after, string before, RequestOptions options)
{
Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
-
- AzureMessagesPageEnumerator enumerator = new(Pipeline, _endpoint, threadId, limit, order, after, before, _apiVersion, options);
- return PageCollectionHelpers.CreateAsync(enumerator);
+ return new AzureAsyncCollectionResult(
+ Pipeline,
+ options,
+ continuation => CreateGetMessagesRequest(threadId, limit, order, continuation?.After ?? after, continuation?.Before ?? before, options),
+ page => MessageCollectionPageToken.FromResponse(page, threadId, limit, order, before),
+ page => ModelReaderWriter.Read(page.GetRawResponse().Content).Data,
+ options?.CancellationToken ?? default);
}
- public override IEnumerable GetMessages(string threadId, int? limit, string order, string after, string before, RequestOptions options)
+ public override CollectionResult GetMessages(string threadId, int? limit, string order, string after, string before, RequestOptions options)
{
Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
-
- AzureMessagesPageEnumerator enumerator = new(Pipeline, _endpoint, threadId, limit, order, after, before, _apiVersion, options);
- return PageCollectionHelpers.Create(enumerator);
+ return new AzureCollectionResult(
+ Pipeline,
+ options,
+ continuation => CreateGetMessagesRequest(threadId, limit, order, continuation?.After ?? after, continuation?.Before ?? before, options),
+ page => MessageCollectionPageToken.FromResponse(page, threadId, limit, order, before),
+ page => ModelReaderWriter.Read(page.GetRawResponse().Content).Data);
}
///
@@ -257,20 +274,27 @@ public override ClientResult CreateRun(string threadId, BinaryContent content, R
}
}
- public override IAsyncEnumerable GetRunsAsync(string threadId, int? limit, string order, string after, string before, RequestOptions options)
+ public override AsyncCollectionResult GetRunsAsync(string threadId, int? limit, string order, string after, string before, RequestOptions options)
{
Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
-
- AzureRunsPageEnumerator enumerator = new(Pipeline, _endpoint, threadId, limit, order, after, before, _apiVersion, options);
- return PageCollectionHelpers.CreateAsync(enumerator);
+ return new AzureAsyncCollectionResult(
+ Pipeline,
+ options,
+ continuation => CreateGetRunsRequest(threadId, limit, order, continuation?.After ?? after, continuation?.Before ?? before, options),
+ page => RunCollectionPageToken.FromResponse(page, threadId, limit, order, before),
+ page => ModelReaderWriter.Read(page.GetRawResponse().Content).Data,
+ options?.CancellationToken ?? default);
}
- public override IEnumerable GetRuns(string threadId, int? limit, string order, string after, string before, RequestOptions options)
+ public override CollectionResult GetRuns(string threadId, int? limit, string order, string after, string before, RequestOptions options)
{
Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
-
- AzureRunsPageEnumerator enumerator = new(Pipeline, _endpoint, threadId, limit, order, after, before, _apiVersion, options);
- return PageCollectionHelpers.Create(enumerator);
+ return new AzureCollectionResult(
+ Pipeline,
+ options,
+ continuation => CreateGetRunsRequest(threadId, limit, order, continuation?.After ?? after, continuation?.Before ?? before, options),
+ page => RunCollectionPageToken.FromResponse(page, threadId, limit, order, before),
+ page => ModelReaderWriter.Read(page.GetRawResponse().Content).Data);
}
///
@@ -375,22 +399,31 @@ public override ClientResult SubmitToolOutputsToRun(string threadId, string runI
}
}
- public override IAsyncEnumerable GetRunStepsAsync(string threadId, string runId, int? limit, string order, string after, string before, RequestOptions options)
+ public override AsyncCollectionResult GetRunStepsAsync(string threadId, string runId, int? limit, string order, string after, string before, RequestOptions options)
{
Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
Argument.AssertNotNullOrEmpty(runId, nameof(runId));
- AzureRunStepsPageEnumerator enumerator = new(Pipeline, _endpoint, threadId, runId, limit, order, after, before, _apiVersion, options);
- return PageCollectionHelpers.CreateAsync(enumerator);
+ return new AzureAsyncCollectionResult(
+ Pipeline,
+ options,
+ continuation => CreateGetRunStepsRequest(threadId, runId, limit, order, continuation?.After ?? after, continuation?.Before ?? before, options),
+ page => RunStepCollectionPageToken.FromResponse(page, threadId, runId, limit, order, before),
+ page => ModelReaderWriter.Read(page.GetRawResponse().Content).Data,
+ options?.CancellationToken ?? default);
}
- public override IEnumerable GetRunSteps(string threadId, string runId, int? limit, string order, string after, string before, RequestOptions options)
+ public override CollectionResult GetRunSteps(string threadId, string runId, int? limit, string order, string after, string before, RequestOptions options)
{
Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
Argument.AssertNotNullOrEmpty(runId, nameof(runId));
- AzureRunStepsPageEnumerator enumerator = new(Pipeline, _endpoint, threadId, runId, limit, order, after, before, _apiVersion, options);
- return PageCollectionHelpers.Create(enumerator);
+ return new AzureCollectionResult(
+ Pipeline,
+ options,
+ continuation => CreateGetRunStepsRequest(threadId, runId, limit, order, continuation?.After ?? after, continuation?.Before ?? before, options),
+ page => RunStepCollectionPageToken.FromResponse(page, threadId, runId, limit, order, before),
+ page => ModelReaderWriter.Read(page.GetRawResponse().Content).Data);
}
///
@@ -486,6 +519,9 @@ public override ClientResult DeleteThread(string threadId, RequestOptions option
private new PipelineMessage CreateCreateAssistantRequest(BinaryContent content, RequestOptions options = null)
=> NewJsonPostBuilder(content, options).WithPath("assistants").Build();
+ private new PipelineMessage CreateGetAssistantsRequest(int? limit, string order, string after, string before, RequestOptions options)
+ => NewGetListBuilder(limit, order, after, before, options).WithPath("assistants").Build();
+
private new PipelineMessage CreateGetAssistantRequest(string assistantId, RequestOptions options)
=> NewJsonGetBuilder(options).WithPath("assistants", assistantId).Build();
@@ -513,6 +549,9 @@ private PipelineMessage CreateDeleteThreadRequest(string threadId, RequestOption
private PipelineMessage CreateCreateMessageRequest(string threadId, BinaryContent content, RequestOptions options)
=> NewJsonPostBuilder(content, options).WithPath("threads", threadId, "messages").Build();
+ private PipelineMessage CreateGetMessagesRequest(string threadId, int? limit, string order, string after, string before, RequestOptions options)
+ => NewGetListBuilder(limit, order, after, before, options).WithPath("threads", threadId, "messages").Build();
+
private PipelineMessage CreateGetMessageRequest(string threadId, string messageId, RequestOptions options)
=> NewJsonGetBuilder(options).WithPath("threads", threadId, "messages", messageId).Build();
@@ -528,6 +567,9 @@ private PipelineMessage CreateCreateThreadAndRunRequest(BinaryContent content, R
private PipelineMessage CreateCreateRunRequest(string threadId, BinaryContent content, RequestOptions options)
=> NewJsonPostBuilder(content, options).WithPath("threads", threadId, "runs").Build();
+ private PipelineMessage CreateGetRunsRequest(string threadId, int? limit, string order, string after, string before, RequestOptions options)
+ => NewGetListBuilder(limit, order, after, before, options).WithPath("threads", threadId, "runs").Build();
+
private PipelineMessage CreateGetRunRequest(string threadId, string runId, RequestOptions options)
=> NewJsonGetBuilder(options).WithPath("threads", threadId, "runs", runId).Build();
@@ -540,6 +582,9 @@ private PipelineMessage CreateCancelRunRequest(string threadId, string runId, Re
private PipelineMessage CreateSubmitToolOutputsToRunRequest(string threadId, string runId, BinaryContent content, RequestOptions options)
=> NewJsonPostBuilder(content, options).WithPath("threads", threadId, "runs", runId, "submit_tool_outputs").Build();
+ private PipelineMessage CreateGetRunStepsRequest(string threadId, string runId, int? limit, string order, string after, string before, RequestOptions options)
+ => NewGetListBuilder(limit, order, after, before, options).WithPath("threads", threadId, "runs", runId, "steps").Build();
+
private PipelineMessage CreateGetRunStepRequest(string threadId, string runId, string stepId, RequestOptions options)
=> NewJsonGetBuilder(options).WithPath("threads", threadId, "runs", runId, "steps", stepId).Build();
diff --git a/sdk/openai/Azure.AI.OpenAI/src/Custom/Assistants/Internal/Pagination/AzureAssistantsPageEnumerator.cs b/sdk/openai/Azure.AI.OpenAI/src/Custom/Assistants/Internal/Pagination/AzureAssistantsPageEnumerator.cs
deleted file mode 100644
index f351279a7f04..000000000000
--- a/sdk/openai/Azure.AI.OpenAI/src/Custom/Assistants/Internal/Pagination/AzureAssistantsPageEnumerator.cs
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License.
-
-using System.ClientModel;
-using System.ClientModel.Primitives;
-
-#nullable enable
-
-namespace Azure.AI.OpenAI.Assistants;
-
-internal partial class AzureAssistantsPageEnumerator : AssistantsPageEnumerator
-{
- private readonly Uri _endpoint;
- private readonly string _apiVersion;
-
- public AzureAssistantsPageEnumerator(
- ClientPipeline pipeline,
- Uri endpoint,
- int? limit, string order, string after, string before,
- string apiVersion,
- RequestOptions options)
- : base(pipeline, endpoint, limit, order, after, before, options)
- {
- _endpoint = endpoint;
- _apiVersion = apiVersion;
- }
-
- internal override async Task GetAssistantsAsync(int? limit, string order, string after, string before, RequestOptions options)
- {
- using PipelineMessage message = CreateGetAssistantsRequest(limit, order, after, before, options);
- return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
- }
-
- internal override ClientResult GetAssistants(int? limit, string order, string after, string before, RequestOptions options)
- {
- using PipelineMessage message = CreateGetAssistantsRequest(limit, order, after, before, options);
- return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options));
- }
-
- private PipelineMessage CreateGetAssistantsRequest(int? limit, string order, string after, string before, RequestOptions options)
- => new AzureOpenAIPipelineMessageBuilder(Pipeline, _endpoint, _apiVersion)
- .WithAssistantsHeader()
- .WithOptions(options)
- .WithMethod("GET")
- .WithAccept("application/json")
- .WithCommonListParameters(limit, order, after, before)
- .WithPath("assistants")
- .Build();
-}
diff --git a/sdk/openai/Azure.AI.OpenAI/src/Custom/Assistants/Internal/Pagination/AzureMessagesPageEnumerator.cs b/sdk/openai/Azure.AI.OpenAI/src/Custom/Assistants/Internal/Pagination/AzureMessagesPageEnumerator.cs
deleted file mode 100644
index 79ad28d13aa4..000000000000
--- a/sdk/openai/Azure.AI.OpenAI/src/Custom/Assistants/Internal/Pagination/AzureMessagesPageEnumerator.cs
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License.
-
-using System.ClientModel;
-using System.ClientModel.Primitives;
-
-namespace Azure.AI.OpenAI.Assistants;
-
-internal partial class AzureMessagesPageEnumerator : MessagesPageEnumerator
-{
- private readonly Uri _endpoint;
- private readonly string _apiVersion;
-
- public AzureMessagesPageEnumerator(
- ClientPipeline pipeline,
- Uri endpoint,
- string threadId,
- int? limit, string order, string after, string before,
- string apiVersion,
- RequestOptions options)
- : base(pipeline, endpoint, threadId, limit, order, after, before, options)
- {
- _endpoint = endpoint;
- _apiVersion = apiVersion;
- }
-
- internal override async Task GetMessagesAsync(string threadId, int? limit, string order, string after, string before, RequestOptions options)
- {
- Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
-
- using PipelineMessage message = CreateGetMessagesRequest(threadId, limit, order, after, before, options);
- return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
- }
-
- internal override ClientResult GetMessages(string threadId, int? limit, string order, string after, string before, RequestOptions options)
- {
- Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
-
- using PipelineMessage message = CreateGetMessagesRequest(threadId, limit, order, after, before, options);
- return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options));
- }
-
- private PipelineMessage CreateGetMessagesRequest(string threadId, int? limit, string order, string after, string before, RequestOptions options)
- => new AzureOpenAIPipelineMessageBuilder(Pipeline, _endpoint, _apiVersion)
- .WithAssistantsHeader()
- .WithOptions(options)
- .WithMethod("GET")
- .WithAccept("application/json")
- .WithCommonListParameters(limit, order, after, before)
- .WithPath("threads", threadId, "messages")
- .Build();
-}
diff --git a/sdk/openai/Azure.AI.OpenAI/src/Custom/Assistants/Internal/Pagination/AzureRunStepsPageEnumerator.cs b/sdk/openai/Azure.AI.OpenAI/src/Custom/Assistants/Internal/Pagination/AzureRunStepsPageEnumerator.cs
deleted file mode 100644
index e7f6ae90293f..000000000000
--- a/sdk/openai/Azure.AI.OpenAI/src/Custom/Assistants/Internal/Pagination/AzureRunStepsPageEnumerator.cs
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License.
-
-using System.ClientModel;
-using System.ClientModel.Primitives;
-
-namespace Azure.AI.OpenAI.Assistants;
-
-internal partial class AzureRunStepsPageEnumerator : RunStepsPageEnumerator
-{
- private readonly Uri _endpoint;
- private readonly string _apiVersion;
-
- public AzureRunStepsPageEnumerator(
- ClientPipeline pipeline,
- Uri endpoint,
- string threadId, string runId,
- int? limit, string order, string after, string before,
- string apiVersion,
- RequestOptions options)
- : base(pipeline, endpoint, threadId, runId, limit, order, after, before, options)
- {
- _endpoint = endpoint;
- _apiVersion = apiVersion;
- }
-
- internal override async Task GetRunStepsAsync(string threadId, string runId, int? limit, string order, string after, string before, RequestOptions options)
- {
- Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
- Argument.AssertNotNullOrEmpty(runId, nameof(runId));
-
- using PipelineMessage message = CreateGetRunStepsRequest(threadId, runId, limit, order, after, before, options);
- return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
- }
-
- internal override ClientResult GetRunSteps(string threadId, string runId, int? limit, string order, string after, string before, RequestOptions options)
- {
- Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
- Argument.AssertNotNullOrEmpty(runId, nameof(runId));
-
- using PipelineMessage message = CreateGetRunStepsRequest(threadId, runId, limit, order, after, before, options);
- return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options));
- }
-
- private PipelineMessage CreateGetRunStepsRequest(string threadId, string runId, int? limit, string order, string after, string before, RequestOptions options)
- => new AzureOpenAIPipelineMessageBuilder(Pipeline, _endpoint, _apiVersion)
- .WithAssistantsHeader()
- .WithOptions(options)
- .WithMethod("GET")
- .WithAccept("application/json")
- .WithCommonListParameters(limit, order, after, before)
- .WithPath("threads", threadId, "runs", runId, "steps")
- .Build();
-}
diff --git a/sdk/openai/Azure.AI.OpenAI/src/Custom/Assistants/Internal/Pagination/AzureRunsPageEnumerator.cs b/sdk/openai/Azure.AI.OpenAI/src/Custom/Assistants/Internal/Pagination/AzureRunsPageEnumerator.cs
deleted file mode 100644
index 65afbca20db1..000000000000
--- a/sdk/openai/Azure.AI.OpenAI/src/Custom/Assistants/Internal/Pagination/AzureRunsPageEnumerator.cs
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License.
-
-using System.ClientModel;
-using System.ClientModel.Primitives;
-
-namespace Azure.AI.OpenAI.Assistants;
-
-internal partial class AzureRunsPageEnumerator : RunsPageEnumerator
-{
- private readonly Uri _endpoint;
- private readonly string _apiVersion;
-
- public AzureRunsPageEnumerator(
- ClientPipeline pipeline,
- Uri endpoint,
- string threadId, int? limit, string order, string after, string before,
- string apiVersion,
- RequestOptions options)
- : base(pipeline, endpoint, threadId, limit, order, after, before, options)
- {
- _endpoint = endpoint;
- _apiVersion = apiVersion;
- }
-
- internal override async Task GetRunsAsync(string threadId, int? limit, string order, string after, string before, RequestOptions options)
- {
- Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
-
- using PipelineMessage message = CreateGetRunsRequest(threadId, limit, order, after, before, options);
- return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
- }
-
- internal override ClientResult GetRuns(string threadId, int? limit, string order, string after, string before, RequestOptions options)
- {
- Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
-
- using PipelineMessage message = CreateGetRunsRequest(threadId, limit, order, after, before, options);
- return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options));
- }
-
- private PipelineMessage CreateGetRunsRequest(string threadId, int? limit, string order, string after, string before, RequestOptions options)
- => new AzureOpenAIPipelineMessageBuilder(Pipeline, _endpoint, _apiVersion)
- .WithAssistantsHeader()
- .WithOptions(options)
- .WithMethod("GET")
- .WithAccept("application/json")
- .WithCommonListParameters(limit, order, after, before)
- .WithPath("threads", threadId, "runs")
- .Build();
-}
diff --git a/sdk/openai/Azure.AI.OpenAI/src/Custom/AzureOpenAIClient.cs b/sdk/openai/Azure.AI.OpenAI/src/Custom/AzureOpenAIClient.cs
index 7336207a09ca..5a300e2b3211 100644
--- a/sdk/openai/Azure.AI.OpenAI/src/Custom/AzureOpenAIClient.cs
+++ b/sdk/openai/Azure.AI.OpenAI/src/Custom/AzureOpenAIClient.cs
@@ -122,7 +122,7 @@ public AzureOpenAIClient(Uri endpoint, ApiKeyCredential credential, AzureOpenAIC
/// The API key to authenticate with the service.
/// The options to configure the client.
public AzureOpenAIClient(Uri endpoint, AzureKeyCredential credential, AzureOpenAIClientOptions options)
- : this(CreatePipeline(credential?.Key, options), endpoint, options)
+ : this(CreatePipeline(new ApiKeyCredential(credential?.Key), options), endpoint, options)
{
}
diff --git a/sdk/openai/Azure.AI.OpenAI/src/Custom/AzureOpenAIClientOptions.cs b/sdk/openai/Azure.AI.OpenAI/src/Custom/AzureOpenAIClientOptions.cs
index 1b2989bfb2f3..1449e569d398 100644
--- a/sdk/openai/Azure.AI.OpenAI/src/Custom/AzureOpenAIClientOptions.cs
+++ b/sdk/openai/Azure.AI.OpenAI/src/Custom/AzureOpenAIClientOptions.cs
@@ -56,6 +56,7 @@ public AzureOpenAIClientOptions(ServiceVersion version = LatestVersion)
ServiceVersion.V2024_05_01_Preview => "2024-05-01-preview",
ServiceVersion.V2024_06_01 => "2024-06-01",
ServiceVersion.V2024_07_01_Preview => "2024-07-01-preview",
+ ServiceVersion.V2024_08_01_Preview => "2024-08-01-preview",
_ => throw new NotSupportedException()
};
RetryPolicy = new RetryWithDelaysPolicy();
@@ -69,6 +70,7 @@ public enum ServiceVersion
V2024_05_01_Preview = 8,
V2024_06_01 = 9,
V2024_07_01_Preview = 10,
+ V2024_08_01_Preview = 11,
}
internal class RetryWithDelaysPolicy : ClientRetryPolicy
@@ -99,5 +101,5 @@ protected override TimeSpan GetNextDelay(PipelineMessage message, int tryCount)
}
}
- private const ServiceVersion LatestVersion = ServiceVersion.V2024_07_01_Preview;
+ private const ServiceVersion LatestVersion = ServiceVersion.V2024_08_01_Preview;
}
diff --git a/sdk/openai/Azure.AI.OpenAI/src/Custom/AzureTokenAuthenticationPolicy.cs b/sdk/openai/Azure.AI.OpenAI/src/Custom/AzureTokenAuthenticationPolicy.cs
index 6fb81cb1a94c..257398df9ed3 100644
--- a/sdk/openai/Azure.AI.OpenAI/src/Custom/AzureTokenAuthenticationPolicy.cs
+++ b/sdk/openai/Azure.AI.OpenAI/src/Custom/AzureTokenAuthenticationPolicy.cs
@@ -3,6 +3,7 @@
using Azure.Core;
using System.ClientModel.Primitives;
+using System.Collections.Generic;
using System.Net;
namespace Azure.AI.OpenAI;
diff --git a/sdk/openai/Azure.AI.OpenAI/src/Custom/Batch/AzureBatchClient.Protocol.cs b/sdk/openai/Azure.AI.OpenAI/src/Custom/Batch/AzureBatchClient.Protocol.cs
index 00cec454cb27..b417bc85d82e 100644
--- a/sdk/openai/Azure.AI.OpenAI/src/Custom/Batch/AzureBatchClient.Protocol.cs
+++ b/sdk/openai/Azure.AI.OpenAI/src/Custom/Batch/AzureBatchClient.Protocol.cs
@@ -3,6 +3,7 @@
using System.ClientModel;
using System.ClientModel.Primitives;
+using Azure.AI.OpenAI.Utility;
namespace Azure.AI.OpenAI.Batch;
@@ -24,16 +25,25 @@ public override ClientResult CreateBatch(BinaryContent content, RequestOptions o
return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options));
}
- public override IAsyncEnumerable GetBatchesAsync(string after, int? limit, RequestOptions options)
+ public override AsyncCollectionResult GetBatchesAsync(string after, int? limit, RequestOptions options)
{
- BatchesPageEnumerator enumerator = new(Pipeline, _endpoint, after, limit, options);
- return PageCollectionHelpers.CreateAsync(enumerator);
+ return new AzureAsyncCollectionResult