diff --git a/examples/Assistants/Example01_RetrievalAugmentedGeneration.cs b/examples/Assistants/Example01_RetrievalAugmentedGeneration.cs
index 4e4a6038..eec969be 100644
--- a/examples/Assistants/Example01_RetrievalAugmentedGeneration.cs
+++ b/examples/Assistants/Example01_RetrievalAugmentedGeneration.cs
@@ -3,7 +3,6 @@
using OpenAI.Files;
using System;
using System.ClientModel;
-using System.Collections.Generic;
using System.IO;
using System.Threading;
diff --git a/examples/Assistants/Example01_RetrievalAugmentedGenerationAsync.cs b/examples/Assistants/Example01_RetrievalAugmentedGenerationAsync.cs
index 319e9017..1c26d729 100644
--- a/examples/Assistants/Example01_RetrievalAugmentedGenerationAsync.cs
+++ b/examples/Assistants/Example01_RetrievalAugmentedGenerationAsync.cs
@@ -3,7 +3,6 @@
using OpenAI.Files;
using System;
using System.ClientModel;
-using System.Collections.Generic;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
diff --git a/examples/Assistants/Example03_ListAssistantsWithPagination.cs b/examples/Assistants/Example03_ListAssistantsWithPagination.cs
index 339bb8af..d092a7d2 100644
--- a/examples/Assistants/Example03_ListAssistantsWithPagination.cs
+++ b/examples/Assistants/Example03_ListAssistantsWithPagination.cs
@@ -2,7 +2,6 @@
using OpenAI.Assistants;
using System;
using System.ClientModel;
-using System.Collections.Generic;
namespace OpenAI.Examples;
diff --git a/examples/Assistants/Example03_ListAssistantsWithPaginationAsync.cs b/examples/Assistants/Example03_ListAssistantsWithPaginationAsync.cs
index 7ae4808c..cf2d67aa 100644
--- a/examples/Assistants/Example03_ListAssistantsWithPaginationAsync.cs
+++ b/examples/Assistants/Example03_ListAssistantsWithPaginationAsync.cs
@@ -2,7 +2,6 @@
using OpenAI.Assistants;
using System;
using System.ClientModel;
-using System.Collections.Generic;
using System.Threading.Tasks;
namespace OpenAI.Examples;
diff --git a/src/Custom/Assistants/Internal/InternalRunStepCodeInterpreterLogOutput.cs b/src/Custom/Assistants/Internal/InternalRunStepCodeInterpreterLogOutput.cs
index 4d0a1d8e..de2a72a8 100644
--- a/src/Custom/Assistants/Internal/InternalRunStepCodeInterpreterLogOutput.cs
+++ b/src/Custom/Assistants/Internal/InternalRunStepCodeInterpreterLogOutput.cs
@@ -1,11 +1,10 @@
-namespace OpenAI.Assistants
+namespace OpenAI.Assistants;
+
+/// Text output from the Code Interpreter tool call as part of a run step.
+[CodeGenModel("RunStepDetailsToolCallsCodeOutputLogsObject")]
+internal partial class InternalRunStepCodeInterpreterLogOutput : RunStepCodeInterpreterOutput
{
- /// Text output from the Code Interpreter tool call as part of a run step.
- [CodeGenModel("RunStepDetailsToolCallsCodeOutputLogsObject")]
- internal partial class InternalRunStepCodeInterpreterLogOutput : RunStepCodeInterpreterOutput
- {
- /// The text output from the Code Interpreter tool call.
- [CodeGenMember("Logs")]
- public string InternalLogs { get; }
- }
-}
+ /// The text output from the Code Interpreter tool call.
+ [CodeGenMember("Logs")]
+ public string InternalLogs { get; }
+}
\ No newline at end of file
diff --git a/src/Custom/Assistants/MessageCreationOptions.Serialization.cs b/src/Custom/Assistants/MessageCreationOptions.Serialization.cs
index abbbc25d..1036133e 100644
--- a/src/Custom/Assistants/MessageCreationOptions.Serialization.cs
+++ b/src/Custom/Assistants/MessageCreationOptions.Serialization.cs
@@ -1,25 +1,24 @@
using System.ClientModel.Primitives;
using System.Text.Json;
-namespace OpenAI.Assistants
+namespace OpenAI.Assistants;
+
+public partial class MessageCreationOptions : IJsonModel
{
- public partial class MessageCreationOptions : IJsonModel
+ private void SerializeContent(Utf8JsonWriter writer, ModelReaderWriterOptions options = null)
{
- private void SerializeContent(Utf8JsonWriter writer, ModelReaderWriterOptions options = null)
+ if (Content.Count == 1 && Content[0] is InternalRequestMessageTextContent textContent)
{
- if (Content.Count == 1 && Content[0] is InternalRequestMessageTextContent textContent)
- {
- writer.WriteStringValue(textContent.Text);
- }
- else
+ writer.WriteStringValue(textContent.Text);
+ }
+ else
+ {
+ writer.WriteStartArray();
+ foreach (var item in Content)
{
- writer.WriteStartArray();
- foreach (var item in Content)
- {
- writer.WriteObjectValue(item, options);
- }
- writer.WriteEndArray();
+ writer.WriteObjectValue(item, options);
}
+ writer.WriteEndArray();
}
}
-}
+}
\ No newline at end of file
diff --git a/src/Custom/Assistants/RunStepDetails.cs b/src/Custom/Assistants/RunStepDetails.cs
index e003f0ec..de526f5c 100644
--- a/src/Custom/Assistants/RunStepDetails.cs
+++ b/src/Custom/Assistants/RunStepDetails.cs
@@ -1,16 +1,15 @@
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
-namespace OpenAI.Assistants
+namespace OpenAI.Assistants;
+
+[Experimental("OPENAI001")]
+[CodeGenModel("RunStepObjectStepDetails")]
+public abstract partial class RunStepDetails
{
- [Experimental("OPENAI001")]
- [CodeGenModel("RunStepObjectStepDetails")]
- public abstract partial class RunStepDetails
- {
- public string CreatedMessageId => AsInternalMessageCreation?.InternalMessageId;
- public IReadOnlyList ToolCalls => AsInternalToolCalls ?? [];
+ public string CreatedMessageId => AsInternalMessageCreation?.InternalMessageId;
+ public IReadOnlyList ToolCalls => AsInternalToolCalls ?? [];
- private InternalRunStepDetailsMessageCreationObject AsInternalMessageCreation => this as InternalRunStepDetailsMessageCreationObject;
- private InternalRunStepDetailsToolCallsObject AsInternalToolCalls => this as InternalRunStepDetailsToolCallsObject;
- }
-}
+ private InternalRunStepDetailsMessageCreationObject AsInternalMessageCreation => this as InternalRunStepDetailsMessageCreationObject;
+ private InternalRunStepDetailsToolCallsObject AsInternalToolCalls => this as InternalRunStepDetailsToolCallsObject;
+}
\ No newline at end of file
diff --git a/src/Custom/Assistants/RunTruncationStrategy.cs b/src/Custom/Assistants/RunTruncationStrategy.cs
index d4328f34..5eb39126 100644
--- a/src/Custom/Assistants/RunTruncationStrategy.cs
+++ b/src/Custom/Assistants/RunTruncationStrategy.cs
@@ -2,69 +2,68 @@
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
-namespace OpenAI.Assistants
+namespace OpenAI.Assistants;
+
+/// Controls for how a thread will be truncated prior to the run. Use this to control the intial context window of the run.
+[Experimental("OPENAI001")]
+[CodeGenModel("TruncationObject")]
+[CodeGenSuppress(nameof(RunTruncationStrategy), typeof(InternalTruncationObjectType))]
+public partial class RunTruncationStrategy
{
- /// Controls for how a thread will be truncated prior to the run. Use this to control the intial context window of the run.
- [Experimental("OPENAI001")]
- [CodeGenModel("TruncationObject")]
- [CodeGenSuppress(nameof(RunTruncationStrategy), typeof(InternalTruncationObjectType))]
- public partial class RunTruncationStrategy
- {
- ///
- /// 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;
+ ///
+ /// 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;
- /// The truncation strategy to use for the thread. The default is `auto`. If set to `last_messages`, the thread will be truncated to the n most recent messages in the thread. When set to `auto`, messages in the middle of the thread will be dropped to fit the context length of the model, `max_prompt_tokens`.
- [CodeGenMember("Type")]
- internal readonly InternalTruncationObjectType _type;
+ /// The truncation strategy to use for the thread. The default is `auto`. If set to `last_messages`, the thread will be truncated to the n most recent messages in the thread. When set to `auto`, messages in the middle of the thread will be dropped to fit the context length of the model, `max_prompt_tokens`.
+ [CodeGenMember("Type")]
+ internal readonly InternalTruncationObjectType _type;
- /// The number of most recent messages from the thread when constructing the context for the run.
- ///
- ///
- [CodeGenMember("LastMessages")]
- public int? LastMessages { get; }
+ /// The number of most recent messages from the thread when constructing the context for the run.
+ ///
+ ///
+ [CodeGenMember("LastMessages")]
+ public int? LastMessages { get; }
- ///
- /// The default that will eliminate messages in the middle of the thread
- /// to fit within the context length of the model or the max prompt tokens.
- ///
- public static RunTruncationStrategy Auto { get; } = new(InternalTruncationObjectType.Auto, 0, null);
+ ///
+ /// The default that will eliminate messages in the middle of the thread
+ /// to fit within the context length of the model or the max prompt tokens.
+ ///
+ public static RunTruncationStrategy Auto { get; } = new(InternalTruncationObjectType.Auto, 0, null);
- ///
- /// Creates a new instance using the last_messages strategy type,
- /// which will truncate the thread to specified count of preceding messages for the run.
- ///
- /// The count of last messages that the run should evaluate.
- ///
- public static RunTruncationStrategy CreateLastMessagesStrategy(int lastMessageCount)
- => new(InternalTruncationObjectType.LastMessages, lastMessageCount, null);
- }
-}
+ ///
+ /// Creates a new instance using the last_messages strategy type,
+ /// which will truncate the thread to specified count of preceding messages for the run.
+ ///
+ /// The count of last messages that the run should evaluate.
+ ///
+ public static RunTruncationStrategy CreateLastMessagesStrategy(int lastMessageCount)
+ => new(InternalTruncationObjectType.LastMessages, lastMessageCount, null);
+}
\ No newline at end of file
diff --git a/src/Custom/Audio/AudioTranscriptionOptions.cs b/src/Custom/Audio/AudioTranscriptionOptions.cs
index b13679e0..971bbac5 100644
--- a/src/Custom/Audio/AudioTranscriptionOptions.cs
+++ b/src/Custom/Audio/AudioTranscriptionOptions.cs
@@ -1,4 +1,3 @@
-using OpenAI.Internal;
using System;
using System.Collections.Generic;
using System.IO;
diff --git a/src/Custom/Audio/AudioTranslationOptions.cs b/src/Custom/Audio/AudioTranslationOptions.cs
index 7632ed9c..395183ab 100644
--- a/src/Custom/Audio/AudioTranslationOptions.cs
+++ b/src/Custom/Audio/AudioTranslationOptions.cs
@@ -1,6 +1,3 @@
-using OpenAI.Embeddings;
-using OpenAI.Images;
-using OpenAI.Internal;
using System;
using System.IO;
diff --git a/src/Custom/Chat/ChatResponseFormat.Serialization.cs b/src/Custom/Chat/ChatResponseFormat.Serialization.cs
index ff7fdeaa..4df2335e 100644
--- a/src/Custom/Chat/ChatResponseFormat.Serialization.cs
+++ b/src/Custom/Chat/ChatResponseFormat.Serialization.cs
@@ -1,7 +1,4 @@
-using System;
using System.ClientModel.Primitives;
-using System.Collections.Generic;
-using System.Runtime.CompilerServices;
using System.Text.Json;
namespace OpenAI.Chat;
diff --git a/src/Custom/Chat/ChatTokenTopLogProbabilityDetails.cs b/src/Custom/Chat/ChatTokenTopLogProbabilityDetails.cs
index 3260ce64..df737dee 100644
--- a/src/Custom/Chat/ChatTokenTopLogProbabilityDetails.cs
+++ b/src/Custom/Chat/ChatTokenTopLogProbabilityDetails.cs
@@ -1,5 +1,4 @@
using System;
-using System.Collections.Generic;
namespace OpenAI.Chat;
diff --git a/src/Custom/Chat/ChatToolCall.cs b/src/Custom/Chat/ChatToolCall.cs
index 65f57ede..a35acb40 100644
--- a/src/Custom/Chat/ChatToolCall.cs
+++ b/src/Custom/Chat/ChatToolCall.cs
@@ -1,5 +1,4 @@
using System;
-using System.Collections.Generic;
namespace OpenAI.Chat;
diff --git a/src/Custom/Chat/Internal/InternalChatResponseFormatJsonSchema.cs b/src/Custom/Chat/Internal/InternalChatResponseFormatJsonSchema.cs
index cd9e63b5..9107b051 100644
--- a/src/Custom/Chat/Internal/InternalChatResponseFormatJsonSchema.cs
+++ b/src/Custom/Chat/Internal/InternalChatResponseFormatJsonSchema.cs
@@ -1,9 +1,4 @@
-using System.ClientModel.Primitives;
-using System.Data;
-using System.Text.Json;
-using System;
-
-namespace OpenAI.Chat;
+namespace OpenAI.Chat;
[CodeGenModel("ChatResponseFormatJsonSchema")]
internal partial class InternalChatResponseFormatJsonSchema
diff --git a/src/Custom/Chat/Streaming/StreamingChatToolCallUpdate.cs b/src/Custom/Chat/Streaming/StreamingChatToolCallUpdate.cs
index c53055a2..19f37212 100644
--- a/src/Custom/Chat/Streaming/StreamingChatToolCallUpdate.cs
+++ b/src/Custom/Chat/Streaming/StreamingChatToolCallUpdate.cs
@@ -1,8 +1,4 @@
namespace OpenAI.Chat;
-
-using System;
-using System.Text.Json;
-
///
/// A base representation of an incremental update to a streaming tool call that is part of a streaming chat completion
/// request.
diff --git a/src/Custom/FineTuning/FineTuningClient.Protocol.cs b/src/Custom/FineTuning/FineTuningClient.Protocol.cs
index 513a00f7..1e9a74c8 100644
--- a/src/Custom/FineTuning/FineTuningClient.Protocol.cs
+++ b/src/Custom/FineTuning/FineTuningClient.Protocol.cs
@@ -1,7 +1,6 @@
using System;
using System.ClientModel;
using System.ClientModel.Primitives;
-using System.Collections.Generic;
using System.Threading.Tasks;
namespace OpenAI.FineTuning;
diff --git a/src/Custom/Models/OpenAIModelInfoCollection.Serialization.cs b/src/Custom/Models/OpenAIModelInfoCollection.Serialization.cs
index 6cfc9383..bfaaed2d 100644
--- a/src/Custom/Models/OpenAIModelInfoCollection.Serialization.cs
+++ b/src/Custom/Models/OpenAIModelInfoCollection.Serialization.cs
@@ -1,9 +1,6 @@
-using OpenAI.Models;
using System;
-using System.ClientModel;
using System.ClientModel.Primitives;
using System.Collections.Generic;
-using System.Reflection;
using System.Text.Json;
namespace OpenAI.Models;
diff --git a/src/Custom/Models/OpenAIModelInfoCollection.cs b/src/Custom/Models/OpenAIModelInfoCollection.cs
index 773bab8f..e35580a4 100644
--- a/src/Custom/Models/OpenAIModelInfoCollection.cs
+++ b/src/Custom/Models/OpenAIModelInfoCollection.cs
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
-using System.Reflection;
namespace OpenAI.Models;
diff --git a/src/Custom/VectorStores/VectorStoreCreationOptions.cs b/src/Custom/VectorStores/VectorStoreCreationOptions.cs
index a421d590..b90caf0e 100644
--- a/src/Custom/VectorStores/VectorStoreCreationOptions.cs
+++ b/src/Custom/VectorStores/VectorStoreCreationOptions.cs
@@ -1,4 +1,3 @@
-using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
namespace OpenAI.VectorStores;
diff --git a/src/Generated/AssistantClient.cs b/src/Generated/AssistantClient.cs
index 14c304e8..40ab06b9 100644
--- a/src/Generated/AssistantClient.cs
+++ b/src/Generated/AssistantClient.cs
@@ -5,124 +5,122 @@
using System;
using System.ClientModel;
using System.ClientModel.Primitives;
-using System.Threading.Tasks;
-namespace OpenAI.Assistants
+namespace OpenAI.Assistants;
+
+// Data plane generated sub-client.
+public partial class AssistantClient
{
- // Data plane generated sub-client.
- public partial class AssistantClient
+ private const string AuthorizationHeader = "Authorization";
+ private readonly ApiKeyCredential _keyCredential;
+ private const string AuthorizationApiKeyPrefix = "Bearer";
+ private readonly ClientPipeline _pipeline;
+ private readonly Uri _endpoint;
+
+ public virtual ClientPipeline Pipeline => _pipeline;
+
+ protected AssistantClient()
{
- private const string AuthorizationHeader = "Authorization";
- private readonly ApiKeyCredential _keyCredential;
- private const string AuthorizationApiKeyPrefix = "Bearer";
- private readonly ClientPipeline _pipeline;
- private readonly Uri _endpoint;
+ }
- public virtual ClientPipeline Pipeline => _pipeline;
+ internal PipelineMessage CreateCreateAssistantRequest(BinaryContent content, RequestOptions options)
+ {
+ var message = _pipeline.CreateMessage();
+ message.ResponseClassifier = PipelineMessageClassifier200;
+ var request = message.Request;
+ request.Method = "POST";
+ var uri = new ClientUriBuilder();
+ uri.Reset(_endpoint);
+ uri.AppendPath("/assistants", false);
+ request.Uri = uri.ToUri();
+ request.Headers.Set("Accept", "application/json");
+ request.Headers.Set("Content-Type", "application/json");
+ request.Content = content;
+ message.Apply(options);
+ return message;
+ }
- protected AssistantClient()
+ internal PipelineMessage CreateGetAssistantsRequest(int? limit, string order, string after, string before, RequestOptions options)
+ {
+ var message = _pipeline.CreateMessage();
+ message.ResponseClassifier = PipelineMessageClassifier200;
+ var request = message.Request;
+ request.Method = "GET";
+ var uri = new ClientUriBuilder();
+ uri.Reset(_endpoint);
+ uri.AppendPath("/assistants", false);
+ if (limit != null)
{
+ uri.AppendQuery("limit", limit.Value, true);
}
-
- internal PipelineMessage CreateCreateAssistantRequest(BinaryContent content, RequestOptions options)
+ if (order != null)
{
- var message = _pipeline.CreateMessage();
- message.ResponseClassifier = PipelineMessageClassifier200;
- var request = message.Request;
- request.Method = "POST";
- var uri = new ClientUriBuilder();
- uri.Reset(_endpoint);
- uri.AppendPath("/assistants", false);
- request.Uri = uri.ToUri();
- request.Headers.Set("Accept", "application/json");
- request.Headers.Set("Content-Type", "application/json");
- request.Content = content;
- message.Apply(options);
- return message;
+ uri.AppendQuery("order", order, true);
}
-
- internal PipelineMessage CreateGetAssistantsRequest(int? limit, string order, string after, string before, RequestOptions options)
+ if (after != null)
{
- var message = _pipeline.CreateMessage();
- message.ResponseClassifier = PipelineMessageClassifier200;
- var request = message.Request;
- request.Method = "GET";
- var uri = new ClientUriBuilder();
- uri.Reset(_endpoint);
- uri.AppendPath("/assistants", false);
- if (limit != null)
- {
- uri.AppendQuery("limit", limit.Value, true);
- }
- if (order != null)
- {
- uri.AppendQuery("order", order, true);
- }
- if (after != null)
- {
- uri.AppendQuery("after", after, true);
- }
- if (before != null)
- {
- uri.AppendQuery("before", before, true);
- }
- request.Uri = uri.ToUri();
- request.Headers.Set("Accept", "application/json");
- message.Apply(options);
- return message;
+ uri.AppendQuery("after", after, true);
}
-
- internal PipelineMessage CreateGetAssistantRequest(string assistantId, RequestOptions options)
+ if (before != null)
{
- var message = _pipeline.CreateMessage();
- message.ResponseClassifier = PipelineMessageClassifier200;
- var request = message.Request;
- request.Method = "GET";
- var uri = new ClientUriBuilder();
- uri.Reset(_endpoint);
- uri.AppendPath("/assistants/", false);
- uri.AppendPath(assistantId, true);
- request.Uri = uri.ToUri();
- request.Headers.Set("Accept", "application/json");
- message.Apply(options);
- return message;
+ uri.AppendQuery("before", before, true);
}
+ request.Uri = uri.ToUri();
+ request.Headers.Set("Accept", "application/json");
+ message.Apply(options);
+ return message;
+ }
- internal PipelineMessage CreateModifyAssistantRequest(string assistantId, BinaryContent content, RequestOptions options)
- {
- var message = _pipeline.CreateMessage();
- message.ResponseClassifier = PipelineMessageClassifier200;
- var request = message.Request;
- request.Method = "POST";
- var uri = new ClientUriBuilder();
- uri.Reset(_endpoint);
- uri.AppendPath("/assistants/", false);
- uri.AppendPath(assistantId, true);
- request.Uri = uri.ToUri();
- request.Headers.Set("Accept", "application/json");
- request.Headers.Set("Content-Type", "application/json");
- request.Content = content;
- message.Apply(options);
- return message;
- }
+ internal PipelineMessage CreateGetAssistantRequest(string assistantId, RequestOptions options)
+ {
+ var message = _pipeline.CreateMessage();
+ message.ResponseClassifier = PipelineMessageClassifier200;
+ var request = message.Request;
+ request.Method = "GET";
+ var uri = new ClientUriBuilder();
+ uri.Reset(_endpoint);
+ uri.AppendPath("/assistants/", false);
+ uri.AppendPath(assistantId, true);
+ request.Uri = uri.ToUri();
+ request.Headers.Set("Accept", "application/json");
+ message.Apply(options);
+ return message;
+ }
- internal PipelineMessage CreateDeleteAssistantRequest(string assistantId, RequestOptions options)
- {
- var message = _pipeline.CreateMessage();
- message.ResponseClassifier = PipelineMessageClassifier200;
- var request = message.Request;
- request.Method = "DELETE";
- var uri = new ClientUriBuilder();
- uri.Reset(_endpoint);
- uri.AppendPath("/assistants/", false);
- uri.AppendPath(assistantId, true);
- request.Uri = uri.ToUri();
- request.Headers.Set("Accept", "application/json");
- message.Apply(options);
- return message;
- }
+ internal PipelineMessage CreateModifyAssistantRequest(string assistantId, BinaryContent content, RequestOptions options)
+ {
+ var message = _pipeline.CreateMessage();
+ message.ResponseClassifier = PipelineMessageClassifier200;
+ var request = message.Request;
+ request.Method = "POST";
+ var uri = new ClientUriBuilder();
+ uri.Reset(_endpoint);
+ uri.AppendPath("/assistants/", false);
+ uri.AppendPath(assistantId, true);
+ request.Uri = uri.ToUri();
+ request.Headers.Set("Accept", "application/json");
+ request.Headers.Set("Content-Type", "application/json");
+ request.Content = content;
+ message.Apply(options);
+ return message;
+ }
- private static PipelineMessageClassifier _pipelineMessageClassifier200;
- private static PipelineMessageClassifier PipelineMessageClassifier200 => _pipelineMessageClassifier200 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 200 });
+ internal PipelineMessage CreateDeleteAssistantRequest(string assistantId, RequestOptions options)
+ {
+ var message = _pipeline.CreateMessage();
+ message.ResponseClassifier = PipelineMessageClassifier200;
+ var request = message.Request;
+ request.Method = "DELETE";
+ var uri = new ClientUriBuilder();
+ uri.Reset(_endpoint);
+ uri.AppendPath("/assistants/", false);
+ uri.AppendPath(assistantId, true);
+ request.Uri = uri.ToUri();
+ request.Headers.Set("Accept", "application/json");
+ message.Apply(options);
+ return message;
}
-}
+
+ private static PipelineMessageClassifier _pipelineMessageClassifier200;
+ private static PipelineMessageClassifier PipelineMessageClassifier200 => _pipelineMessageClassifier200 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 200 });
+}
\ No newline at end of file
diff --git a/src/Generated/AudioClient.cs b/src/Generated/AudioClient.cs
index 8b5a4f1d..af43fa68 100644
--- a/src/Generated/AudioClient.cs
+++ b/src/Generated/AudioClient.cs
@@ -5,77 +5,75 @@
using System;
using System.ClientModel;
using System.ClientModel.Primitives;
-using System.Threading.Tasks;
-namespace OpenAI.Audio
-{
- // Data plane generated sub-client.
- public partial class AudioClient
- {
- private const string AuthorizationHeader = "Authorization";
- private readonly ApiKeyCredential _keyCredential;
- private const string AuthorizationApiKeyPrefix = "Bearer";
- private readonly ClientPipeline _pipeline;
- private readonly Uri _endpoint;
+namespace OpenAI.Audio;
- public virtual ClientPipeline Pipeline => _pipeline;
+// Data plane generated sub-client.
+public partial class AudioClient
+{
+ private const string AuthorizationHeader = "Authorization";
+ private readonly ApiKeyCredential _keyCredential;
+ private const string AuthorizationApiKeyPrefix = "Bearer";
+ private readonly ClientPipeline _pipeline;
+ private readonly Uri _endpoint;
- protected AudioClient()
- {
- }
+ public virtual ClientPipeline Pipeline => _pipeline;
- internal PipelineMessage CreateCreateSpeechRequest(BinaryContent content, RequestOptions options)
- {
- var message = _pipeline.CreateMessage();
- message.ResponseClassifier = PipelineMessageClassifier200;
- var request = message.Request;
- request.Method = "POST";
- var uri = new ClientUriBuilder();
- uri.Reset(_endpoint);
- uri.AppendPath("/audio/speech", false);
- request.Uri = uri.ToUri();
- request.Headers.Set("Accept", "application/octet-stream");
- request.Headers.Set("Content-Type", "application/json");
- request.Content = content;
- message.Apply(options);
- return message;
- }
+ protected AudioClient()
+ {
+ }
- internal PipelineMessage CreateCreateTranscriptionRequest(BinaryContent content, string contentType, RequestOptions options)
- {
- var message = _pipeline.CreateMessage();
- message.ResponseClassifier = PipelineMessageClassifier200;
- var request = message.Request;
- request.Method = "POST";
- var uri = new ClientUriBuilder();
- uri.Reset(_endpoint);
- uri.AppendPath("/audio/transcriptions", false);
- request.Uri = uri.ToUri();
- request.Headers.Set("Accept", "application/json");
- request.Headers.Set("Content-Type", contentType);
- request.Content = content;
- message.Apply(options);
- return message;
- }
+ internal PipelineMessage CreateCreateSpeechRequest(BinaryContent content, RequestOptions options)
+ {
+ var message = _pipeline.CreateMessage();
+ message.ResponseClassifier = PipelineMessageClassifier200;
+ var request = message.Request;
+ request.Method = "POST";
+ var uri = new ClientUriBuilder();
+ uri.Reset(_endpoint);
+ uri.AppendPath("/audio/speech", false);
+ request.Uri = uri.ToUri();
+ request.Headers.Set("Accept", "application/octet-stream");
+ request.Headers.Set("Content-Type", "application/json");
+ request.Content = content;
+ message.Apply(options);
+ return message;
+ }
- internal PipelineMessage CreateCreateTranslationRequest(BinaryContent content, string contentType, RequestOptions options)
- {
- var message = _pipeline.CreateMessage();
- message.ResponseClassifier = PipelineMessageClassifier200;
- var request = message.Request;
- request.Method = "POST";
- var uri = new ClientUriBuilder();
- uri.Reset(_endpoint);
- uri.AppendPath("/audio/translations", false);
- request.Uri = uri.ToUri();
- request.Headers.Set("Accept", "application/json");
- request.Headers.Set("Content-Type", contentType);
- request.Content = content;
- message.Apply(options);
- return message;
- }
+ internal PipelineMessage CreateCreateTranscriptionRequest(BinaryContent content, string contentType, RequestOptions options)
+ {
+ var message = _pipeline.CreateMessage();
+ message.ResponseClassifier = PipelineMessageClassifier200;
+ var request = message.Request;
+ request.Method = "POST";
+ var uri = new ClientUriBuilder();
+ uri.Reset(_endpoint);
+ uri.AppendPath("/audio/transcriptions", false);
+ request.Uri = uri.ToUri();
+ request.Headers.Set("Accept", "application/json");
+ request.Headers.Set("Content-Type", contentType);
+ request.Content = content;
+ message.Apply(options);
+ return message;
+ }
- private static PipelineMessageClassifier _pipelineMessageClassifier200;
- private static PipelineMessageClassifier PipelineMessageClassifier200 => _pipelineMessageClassifier200 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 200 });
+ internal PipelineMessage CreateCreateTranslationRequest(BinaryContent content, string contentType, RequestOptions options)
+ {
+ var message = _pipeline.CreateMessage();
+ message.ResponseClassifier = PipelineMessageClassifier200;
+ var request = message.Request;
+ request.Method = "POST";
+ var uri = new ClientUriBuilder();
+ uri.Reset(_endpoint);
+ uri.AppendPath("/audio/translations", false);
+ request.Uri = uri.ToUri();
+ request.Headers.Set("Accept", "application/json");
+ request.Headers.Set("Content-Type", contentType);
+ request.Content = content;
+ message.Apply(options);
+ return message;
}
-}
+
+ private static PipelineMessageClassifier _pipelineMessageClassifier200;
+ private static PipelineMessageClassifier PipelineMessageClassifier200 => _pipelineMessageClassifier200 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 200 });
+}
\ No newline at end of file
diff --git a/src/Generated/BatchClient.cs b/src/Generated/BatchClient.cs
index 3ccd2f90..338e7485 100644
--- a/src/Generated/BatchClient.cs
+++ b/src/Generated/BatchClient.cs
@@ -5,100 +5,97 @@
using System;
using System.ClientModel;
using System.ClientModel.Primitives;
-using System.Collections.Generic;
-using System.Threading.Tasks;
-namespace OpenAI.Batch
+namespace OpenAI.Batch;
+
+// Data plane generated sub-client.
+public partial class BatchClient
{
- // Data plane generated sub-client.
- public partial class BatchClient
- {
- private const string AuthorizationHeader = "Authorization";
- private readonly ApiKeyCredential _keyCredential;
- private const string AuthorizationApiKeyPrefix = "Bearer";
- private readonly ClientPipeline _pipeline;
- private readonly Uri _endpoint;
+ private const string AuthorizationHeader = "Authorization";
+ private readonly ApiKeyCredential _keyCredential;
+ private const string AuthorizationApiKeyPrefix = "Bearer";
+ private readonly ClientPipeline _pipeline;
+ private readonly Uri _endpoint;
- public virtual ClientPipeline Pipeline => _pipeline;
+ public virtual ClientPipeline Pipeline => _pipeline;
- protected BatchClient()
- {
- }
+ protected BatchClient()
+ {
+ }
- internal PipelineMessage CreateCreateBatchRequest(BinaryContent content, RequestOptions options)
- {
- var message = _pipeline.CreateMessage();
- message.ResponseClassifier = PipelineMessageClassifier200;
- var request = message.Request;
- request.Method = "POST";
- var uri = new ClientUriBuilder();
- uri.Reset(_endpoint);
- uri.AppendPath("/batches", false);
- request.Uri = uri.ToUri();
- request.Headers.Set("Accept", "application/json");
- request.Headers.Set("Content-Type", "application/json");
- request.Content = content;
- message.Apply(options);
- return message;
- }
+ internal PipelineMessage CreateCreateBatchRequest(BinaryContent content, RequestOptions options)
+ {
+ var message = _pipeline.CreateMessage();
+ message.ResponseClassifier = PipelineMessageClassifier200;
+ var request = message.Request;
+ request.Method = "POST";
+ var uri = new ClientUriBuilder();
+ uri.Reset(_endpoint);
+ uri.AppendPath("/batches", false);
+ request.Uri = uri.ToUri();
+ request.Headers.Set("Accept", "application/json");
+ request.Headers.Set("Content-Type", "application/json");
+ request.Content = content;
+ message.Apply(options);
+ return message;
+ }
- internal PipelineMessage CreateGetBatchesRequest(string after, int? limit, RequestOptions options)
+ internal PipelineMessage CreateGetBatchesRequest(string after, int? limit, RequestOptions options)
+ {
+ var message = _pipeline.CreateMessage();
+ message.ResponseClassifier = PipelineMessageClassifier200;
+ var request = message.Request;
+ request.Method = "GET";
+ var uri = new ClientUriBuilder();
+ uri.Reset(_endpoint);
+ uri.AppendPath("/batches", false);
+ if (after != null)
{
- var message = _pipeline.CreateMessage();
- message.ResponseClassifier = PipelineMessageClassifier200;
- var request = message.Request;
- request.Method = "GET";
- var uri = new ClientUriBuilder();
- uri.Reset(_endpoint);
- uri.AppendPath("/batches", false);
- if (after != null)
- {
- uri.AppendQuery("after", after, true);
- }
- if (limit != null)
- {
- uri.AppendQuery("limit", limit.Value, true);
- }
- request.Uri = uri.ToUri();
- request.Headers.Set("Accept", "application/json");
- message.Apply(options);
- return message;
+ uri.AppendQuery("after", after, true);
}
-
- internal PipelineMessage CreateRetrieveBatchRequest(string batchId, RequestOptions options)
+ if (limit != null)
{
- var message = _pipeline.CreateMessage();
- message.ResponseClassifier = PipelineMessageClassifier200;
- var request = message.Request;
- request.Method = "GET";
- var uri = new ClientUriBuilder();
- uri.Reset(_endpoint);
- uri.AppendPath("/batches/", false);
- uri.AppendPath(batchId, true);
- request.Uri = uri.ToUri();
- request.Headers.Set("Accept", "application/json");
- message.Apply(options);
- return message;
+ uri.AppendQuery("limit", limit.Value, true);
}
+ request.Uri = uri.ToUri();
+ request.Headers.Set("Accept", "application/json");
+ message.Apply(options);
+ return message;
+ }
- internal PipelineMessage CreateCancelBatchRequest(string batchId, RequestOptions options)
- {
- var message = _pipeline.CreateMessage();
- message.ResponseClassifier = PipelineMessageClassifier200;
- var request = message.Request;
- request.Method = "POST";
- var uri = new ClientUriBuilder();
- uri.Reset(_endpoint);
- uri.AppendPath("/batches/", false);
- uri.AppendPath(batchId, true);
- uri.AppendPath("/cancel", false);
- request.Uri = uri.ToUri();
- request.Headers.Set("Accept", "application/json");
- message.Apply(options);
- return message;
- }
+ internal PipelineMessage CreateRetrieveBatchRequest(string batchId, RequestOptions options)
+ {
+ var message = _pipeline.CreateMessage();
+ message.ResponseClassifier = PipelineMessageClassifier200;
+ var request = message.Request;
+ request.Method = "GET";
+ var uri = new ClientUriBuilder();
+ uri.Reset(_endpoint);
+ uri.AppendPath("/batches/", false);
+ uri.AppendPath(batchId, true);
+ request.Uri = uri.ToUri();
+ request.Headers.Set("Accept", "application/json");
+ message.Apply(options);
+ return message;
+ }
- private static PipelineMessageClassifier _pipelineMessageClassifier200;
- private static PipelineMessageClassifier PipelineMessageClassifier200 => _pipelineMessageClassifier200 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 200 });
+ internal PipelineMessage CreateCancelBatchRequest(string batchId, RequestOptions options)
+ {
+ var message = _pipeline.CreateMessage();
+ message.ResponseClassifier = PipelineMessageClassifier200;
+ var request = message.Request;
+ request.Method = "POST";
+ var uri = new ClientUriBuilder();
+ uri.Reset(_endpoint);
+ uri.AppendPath("/batches/", false);
+ uri.AppendPath(batchId, true);
+ uri.AppendPath("/cancel", false);
+ request.Uri = uri.ToUri();
+ request.Headers.Set("Accept", "application/json");
+ message.Apply(options);
+ return message;
}
-}
+
+ private static PipelineMessageClassifier _pipelineMessageClassifier200;
+ private static PipelineMessageClassifier PipelineMessageClassifier200 => _pipelineMessageClassifier200 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 200 });
+}
\ No newline at end of file
diff --git a/src/Generated/ChatClient.cs b/src/Generated/ChatClient.cs
index 6db94d5e..a15d1d52 100644
--- a/src/Generated/ChatClient.cs
+++ b/src/Generated/ChatClient.cs
@@ -5,43 +5,41 @@
using System;
using System.ClientModel;
using System.ClientModel.Primitives;
-using System.Threading.Tasks;
-namespace OpenAI.Chat
+namespace OpenAI.Chat;
+
+// Data plane generated sub-client.
+public partial class ChatClient
{
- // Data plane generated sub-client.
- public partial class ChatClient
+ private const string AuthorizationHeader = "Authorization";
+ private readonly ApiKeyCredential _keyCredential;
+ private const string AuthorizationApiKeyPrefix = "Bearer";
+ private readonly ClientPipeline _pipeline;
+ private readonly Uri _endpoint;
+
+ public virtual ClientPipeline Pipeline => _pipeline;
+
+ protected ChatClient()
{
- private const string AuthorizationHeader = "Authorization";
- private readonly ApiKeyCredential _keyCredential;
- private const string AuthorizationApiKeyPrefix = "Bearer";
- private readonly ClientPipeline _pipeline;
- private readonly Uri _endpoint;
-
- public virtual ClientPipeline Pipeline => _pipeline;
-
- protected ChatClient()
- {
- }
-
- internal PipelineMessage CreateCreateChatCompletionRequest(BinaryContent content, RequestOptions options)
- {
- var message = _pipeline.CreateMessage();
- message.ResponseClassifier = PipelineMessageClassifier200;
- var request = message.Request;
- request.Method = "POST";
- var uri = new ClientUriBuilder();
- uri.Reset(_endpoint);
- uri.AppendPath("/chat/completions", false);
- request.Uri = uri.ToUri();
- request.Headers.Set("Accept", "application/json");
- request.Headers.Set("Content-Type", "application/json");
- request.Content = content;
- message.Apply(options);
- return message;
- }
-
- private static PipelineMessageClassifier _pipelineMessageClassifier200;
- private static PipelineMessageClassifier PipelineMessageClassifier200 => _pipelineMessageClassifier200 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 200 });
}
-}
+
+ internal PipelineMessage CreateCreateChatCompletionRequest(BinaryContent content, RequestOptions options)
+ {
+ var message = _pipeline.CreateMessage();
+ message.ResponseClassifier = PipelineMessageClassifier200;
+ var request = message.Request;
+ request.Method = "POST";
+ var uri = new ClientUriBuilder();
+ uri.Reset(_endpoint);
+ uri.AppendPath("/chat/completions", false);
+ request.Uri = uri.ToUri();
+ request.Headers.Set("Accept", "application/json");
+ request.Headers.Set("Content-Type", "application/json");
+ request.Content = content;
+ message.Apply(options);
+ return message;
+ }
+
+ private static PipelineMessageClassifier _pipelineMessageClassifier200;
+ private static PipelineMessageClassifier PipelineMessageClassifier200 => _pipelineMessageClassifier200 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 200 });
+}
\ No newline at end of file
diff --git a/src/Generated/EmbeddingClient.cs b/src/Generated/EmbeddingClient.cs
index e93cade4..bd71146c 100644
--- a/src/Generated/EmbeddingClient.cs
+++ b/src/Generated/EmbeddingClient.cs
@@ -5,43 +5,41 @@
using System;
using System.ClientModel;
using System.ClientModel.Primitives;
-using System.Threading.Tasks;
-namespace OpenAI.Embeddings
+namespace OpenAI.Embeddings;
+
+// Data plane generated sub-client.
+public partial class EmbeddingClient
{
- // Data plane generated sub-client.
- public partial class EmbeddingClient
+ private const string AuthorizationHeader = "Authorization";
+ private readonly ApiKeyCredential _keyCredential;
+ private const string AuthorizationApiKeyPrefix = "Bearer";
+ private readonly ClientPipeline _pipeline;
+ private readonly Uri _endpoint;
+
+ public virtual ClientPipeline Pipeline => _pipeline;
+
+ protected EmbeddingClient()
{
- private const string AuthorizationHeader = "Authorization";
- private readonly ApiKeyCredential _keyCredential;
- private const string AuthorizationApiKeyPrefix = "Bearer";
- private readonly ClientPipeline _pipeline;
- private readonly Uri _endpoint;
-
- public virtual ClientPipeline Pipeline => _pipeline;
-
- protected EmbeddingClient()
- {
- }
-
- internal PipelineMessage CreateCreateEmbeddingRequest(BinaryContent content, RequestOptions options)
- {
- var message = _pipeline.CreateMessage();
- message.ResponseClassifier = PipelineMessageClassifier200;
- var request = message.Request;
- request.Method = "POST";
- var uri = new ClientUriBuilder();
- uri.Reset(_endpoint);
- uri.AppendPath("/embeddings", false);
- request.Uri = uri.ToUri();
- request.Headers.Set("Accept", "application/json");
- request.Headers.Set("Content-Type", "application/json");
- request.Content = content;
- message.Apply(options);
- return message;
- }
-
- private static PipelineMessageClassifier _pipelineMessageClassifier200;
- private static PipelineMessageClassifier PipelineMessageClassifier200 => _pipelineMessageClassifier200 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 200 });
}
-}
+
+ internal PipelineMessage CreateCreateEmbeddingRequest(BinaryContent content, RequestOptions options)
+ {
+ var message = _pipeline.CreateMessage();
+ message.ResponseClassifier = PipelineMessageClassifier200;
+ var request = message.Request;
+ request.Method = "POST";
+ var uri = new ClientUriBuilder();
+ uri.Reset(_endpoint);
+ uri.AppendPath("/embeddings", false);
+ request.Uri = uri.ToUri();
+ request.Headers.Set("Accept", "application/json");
+ request.Headers.Set("Content-Type", "application/json");
+ request.Content = content;
+ message.Apply(options);
+ return message;
+ }
+
+ private static PipelineMessageClassifier _pipelineMessageClassifier200;
+ private static PipelineMessageClassifier PipelineMessageClassifier200 => _pipelineMessageClassifier200 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 200 });
+}
\ No newline at end of file
diff --git a/src/Generated/FileClient.cs b/src/Generated/FileClient.cs
index 131f6ba5..a38869dd 100644
--- a/src/Generated/FileClient.cs
+++ b/src/Generated/FileClient.cs
@@ -5,111 +5,109 @@
using System;
using System.ClientModel;
using System.ClientModel.Primitives;
-using System.Threading.Tasks;
-namespace OpenAI.Files
+namespace OpenAI.Files;
+
+// Data plane generated sub-client.
+public partial class FileClient
{
- // Data plane generated sub-client.
- public partial class FileClient
- {
- private const string AuthorizationHeader = "Authorization";
- private readonly ApiKeyCredential _keyCredential;
- private const string AuthorizationApiKeyPrefix = "Bearer";
- private readonly ClientPipeline _pipeline;
- private readonly Uri _endpoint;
+ private const string AuthorizationHeader = "Authorization";
+ private readonly ApiKeyCredential _keyCredential;
+ private const string AuthorizationApiKeyPrefix = "Bearer";
+ private readonly ClientPipeline _pipeline;
+ private readonly Uri _endpoint;
- public virtual ClientPipeline Pipeline => _pipeline;
+ public virtual ClientPipeline Pipeline => _pipeline;
- protected FileClient()
- {
- }
-
- internal PipelineMessage CreateCreateFileRequest(BinaryContent content, string contentType, RequestOptions options)
- {
- var message = _pipeline.CreateMessage();
- message.ResponseClassifier = PipelineMessageClassifier200;
- var request = message.Request;
- request.Method = "POST";
- var uri = new ClientUriBuilder();
- uri.Reset(_endpoint);
- uri.AppendPath("/files", false);
- request.Uri = uri.ToUri();
- request.Headers.Set("Accept", "application/json");
- request.Headers.Set("Content-Type", contentType);
- request.Content = content;
- message.Apply(options);
- return message;
- }
+ protected FileClient()
+ {
+ }
- internal PipelineMessage CreateGetFilesRequest(string purpose, RequestOptions options)
- {
- var message = _pipeline.CreateMessage();
- message.ResponseClassifier = PipelineMessageClassifier200;
- var request = message.Request;
- request.Method = "GET";
- var uri = new ClientUriBuilder();
- uri.Reset(_endpoint);
- uri.AppendPath("/files", false);
- if (purpose != null)
- {
- uri.AppendQuery("purpose", purpose, true);
- }
- request.Uri = uri.ToUri();
- request.Headers.Set("Accept", "application/json");
- message.Apply(options);
- return message;
- }
+ internal PipelineMessage CreateCreateFileRequest(BinaryContent content, string contentType, RequestOptions options)
+ {
+ var message = _pipeline.CreateMessage();
+ message.ResponseClassifier = PipelineMessageClassifier200;
+ var request = message.Request;
+ request.Method = "POST";
+ var uri = new ClientUriBuilder();
+ uri.Reset(_endpoint);
+ uri.AppendPath("/files", false);
+ request.Uri = uri.ToUri();
+ request.Headers.Set("Accept", "application/json");
+ request.Headers.Set("Content-Type", contentType);
+ request.Content = content;
+ message.Apply(options);
+ return message;
+ }
- internal PipelineMessage CreateRetrieveFileRequest(string fileId, RequestOptions options)
+ internal PipelineMessage CreateGetFilesRequest(string purpose, RequestOptions options)
+ {
+ var message = _pipeline.CreateMessage();
+ message.ResponseClassifier = PipelineMessageClassifier200;
+ var request = message.Request;
+ request.Method = "GET";
+ var uri = new ClientUriBuilder();
+ uri.Reset(_endpoint);
+ uri.AppendPath("/files", false);
+ if (purpose != null)
{
- var message = _pipeline.CreateMessage();
- message.ResponseClassifier = PipelineMessageClassifier200;
- var request = message.Request;
- request.Method = "GET";
- var uri = new ClientUriBuilder();
- uri.Reset(_endpoint);
- uri.AppendPath("/files/", false);
- uri.AppendPath(fileId, true);
- request.Uri = uri.ToUri();
- request.Headers.Set("Accept", "application/json");
- message.Apply(options);
- return message;
+ uri.AppendQuery("purpose", purpose, true);
}
+ request.Uri = uri.ToUri();
+ request.Headers.Set("Accept", "application/json");
+ message.Apply(options);
+ return message;
+ }
- internal PipelineMessage CreateDeleteFileRequest(string fileId, RequestOptions options)
- {
- var message = _pipeline.CreateMessage();
- message.ResponseClassifier = PipelineMessageClassifier200;
- var request = message.Request;
- request.Method = "DELETE";
- var uri = new ClientUriBuilder();
- uri.Reset(_endpoint);
- uri.AppendPath("/files/", false);
- uri.AppendPath(fileId, true);
- request.Uri = uri.ToUri();
- request.Headers.Set("Accept", "application/json");
- message.Apply(options);
- return message;
- }
+ internal PipelineMessage CreateRetrieveFileRequest(string fileId, RequestOptions options)
+ {
+ var message = _pipeline.CreateMessage();
+ message.ResponseClassifier = PipelineMessageClassifier200;
+ var request = message.Request;
+ request.Method = "GET";
+ var uri = new ClientUriBuilder();
+ uri.Reset(_endpoint);
+ uri.AppendPath("/files/", false);
+ uri.AppendPath(fileId, true);
+ request.Uri = uri.ToUri();
+ request.Headers.Set("Accept", "application/json");
+ message.Apply(options);
+ return message;
+ }
- internal PipelineMessage CreateDownloadFileRequest(string fileId, RequestOptions options)
- {
- var message = _pipeline.CreateMessage();
- message.ResponseClassifier = PipelineMessageClassifier200;
- var request = message.Request;
- request.Method = "GET";
- var uri = new ClientUriBuilder();
- uri.Reset(_endpoint);
- uri.AppendPath("/files/", false);
- uri.AppendPath(fileId, true);
- uri.AppendPath("/content", false);
- request.Uri = uri.ToUri();
- request.Headers.Set("Accept", "application/json");
- message.Apply(options);
- return message;
- }
+ internal PipelineMessage CreateDeleteFileRequest(string fileId, RequestOptions options)
+ {
+ var message = _pipeline.CreateMessage();
+ message.ResponseClassifier = PipelineMessageClassifier200;
+ var request = message.Request;
+ request.Method = "DELETE";
+ var uri = new ClientUriBuilder();
+ uri.Reset(_endpoint);
+ uri.AppendPath("/files/", false);
+ uri.AppendPath(fileId, true);
+ request.Uri = uri.ToUri();
+ request.Headers.Set("Accept", "application/json");
+ message.Apply(options);
+ return message;
+ }
- private static PipelineMessageClassifier _pipelineMessageClassifier200;
- private static PipelineMessageClassifier PipelineMessageClassifier200 => _pipelineMessageClassifier200 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 200 });
+ internal PipelineMessage CreateDownloadFileRequest(string fileId, RequestOptions options)
+ {
+ var message = _pipeline.CreateMessage();
+ message.ResponseClassifier = PipelineMessageClassifier200;
+ var request = message.Request;
+ request.Method = "GET";
+ var uri = new ClientUriBuilder();
+ uri.Reset(_endpoint);
+ uri.AppendPath("/files/", false);
+ uri.AppendPath(fileId, true);
+ uri.AppendPath("/content", false);
+ request.Uri = uri.ToUri();
+ request.Headers.Set("Accept", "application/json");
+ message.Apply(options);
+ return message;
}
-}
+
+ private static PipelineMessageClassifier _pipelineMessageClassifier200;
+ private static PipelineMessageClassifier PipelineMessageClassifier200 => _pipelineMessageClassifier200 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 200 });
+}
\ No newline at end of file
diff --git a/src/Generated/FineTuningClient.cs b/src/Generated/FineTuningClient.cs
index c4446699..c1b0f5ab 100644
--- a/src/Generated/FineTuningClient.cs
+++ b/src/Generated/FineTuningClient.cs
@@ -5,149 +5,147 @@
using System;
using System.ClientModel;
using System.ClientModel.Primitives;
-using System.Threading.Tasks;
-namespace OpenAI.FineTuning
+namespace OpenAI.FineTuning;
+
+// Data plane generated sub-client.
+public partial class FineTuningClient
{
- // Data plane generated sub-client.
- public partial class FineTuningClient
+ private const string AuthorizationHeader = "Authorization";
+ private readonly ApiKeyCredential _keyCredential;
+ private const string AuthorizationApiKeyPrefix = "Bearer";
+ private readonly ClientPipeline _pipeline;
+ private readonly Uri _endpoint;
+
+ public virtual ClientPipeline Pipeline => _pipeline;
+
+ protected FineTuningClient()
{
- private const string AuthorizationHeader = "Authorization";
- private readonly ApiKeyCredential _keyCredential;
- private const string AuthorizationApiKeyPrefix = "Bearer";
- private readonly ClientPipeline _pipeline;
- private readonly Uri _endpoint;
+ }
- public virtual ClientPipeline Pipeline => _pipeline;
+ internal PipelineMessage CreateCreateFineTuningJobRequest(BinaryContent content, RequestOptions options)
+ {
+ var message = _pipeline.CreateMessage();
+ message.ResponseClassifier = PipelineMessageClassifier200;
+ var request = message.Request;
+ request.Method = "POST";
+ var uri = new ClientUriBuilder();
+ uri.Reset(_endpoint);
+ uri.AppendPath("/fine_tuning/jobs", false);
+ request.Uri = uri.ToUri();
+ request.Headers.Set("Accept", "application/json");
+ request.Headers.Set("Content-Type", "application/json");
+ request.Content = content;
+ message.Apply(options);
+ return message;
+ }
- protected FineTuningClient()
+ internal PipelineMessage CreateGetPaginatedFineTuningJobsRequest(string after, int? limit, RequestOptions options)
+ {
+ var message = _pipeline.CreateMessage();
+ message.ResponseClassifier = PipelineMessageClassifier200;
+ var request = message.Request;
+ request.Method = "GET";
+ var uri = new ClientUriBuilder();
+ uri.Reset(_endpoint);
+ uri.AppendPath("/fine_tuning/jobs", false);
+ if (after != null)
{
+ uri.AppendQuery("after", after, true);
}
-
- internal PipelineMessage CreateCreateFineTuningJobRequest(BinaryContent content, RequestOptions options)
+ if (limit != null)
{
- var message = _pipeline.CreateMessage();
- message.ResponseClassifier = PipelineMessageClassifier200;
- var request = message.Request;
- request.Method = "POST";
- var uri = new ClientUriBuilder();
- uri.Reset(_endpoint);
- uri.AppendPath("/fine_tuning/jobs", false);
- request.Uri = uri.ToUri();
- request.Headers.Set("Accept", "application/json");
- request.Headers.Set("Content-Type", "application/json");
- request.Content = content;
- message.Apply(options);
- return message;
+ uri.AppendQuery("limit", limit.Value, true);
}
+ request.Uri = uri.ToUri();
+ request.Headers.Set("Accept", "application/json");
+ message.Apply(options);
+ return message;
+ }
- internal PipelineMessage CreateGetPaginatedFineTuningJobsRequest(string after, int? limit, RequestOptions options)
- {
- var message = _pipeline.CreateMessage();
- message.ResponseClassifier = PipelineMessageClassifier200;
- var request = message.Request;
- request.Method = "GET";
- var uri = new ClientUriBuilder();
- uri.Reset(_endpoint);
- uri.AppendPath("/fine_tuning/jobs", false);
- if (after != null)
- {
- uri.AppendQuery("after", after, true);
- }
- if (limit != null)
- {
- uri.AppendQuery("limit", limit.Value, true);
- }
- request.Uri = uri.ToUri();
- request.Headers.Set("Accept", "application/json");
- message.Apply(options);
- return message;
- }
+ internal PipelineMessage CreateRetrieveFineTuningJobRequest(string fineTuningJobId, RequestOptions options)
+ {
+ var message = _pipeline.CreateMessage();
+ message.ResponseClassifier = PipelineMessageClassifier200;
+ var request = message.Request;
+ request.Method = "GET";
+ var uri = new ClientUriBuilder();
+ uri.Reset(_endpoint);
+ uri.AppendPath("/fine_tuning/jobs/", false);
+ uri.AppendPath(fineTuningJobId, true);
+ request.Uri = uri.ToUri();
+ request.Headers.Set("Accept", "application/json");
+ message.Apply(options);
+ return message;
+ }
+
+ internal PipelineMessage CreateCancelFineTuningJobRequest(string fineTuningJobId, RequestOptions options)
+ {
+ var message = _pipeline.CreateMessage();
+ message.ResponseClassifier = PipelineMessageClassifier200;
+ var request = message.Request;
+ request.Method = "POST";
+ var uri = new ClientUriBuilder();
+ uri.Reset(_endpoint);
+ uri.AppendPath("/fine_tuning/jobs/", false);
+ uri.AppendPath(fineTuningJobId, true);
+ uri.AppendPath("/cancel", false);
+ request.Uri = uri.ToUri();
+ request.Headers.Set("Accept", "application/json");
+ message.Apply(options);
+ return message;
+ }
- internal PipelineMessage CreateRetrieveFineTuningJobRequest(string fineTuningJobId, RequestOptions options)
+ internal PipelineMessage CreateGetFineTuningJobCheckpointsRequest(string fineTuningJobId, string after, int? limit, RequestOptions options)
+ {
+ var message = _pipeline.CreateMessage();
+ message.ResponseClassifier = PipelineMessageClassifier200;
+ var request = message.Request;
+ request.Method = "GET";
+ var uri = new ClientUriBuilder();
+ uri.Reset(_endpoint);
+ uri.AppendPath("/fine_tuning/jobs/", false);
+ uri.AppendPath(fineTuningJobId, true);
+ uri.AppendPath("/checkpoints", false);
+ if (after != null)
{
- var message = _pipeline.CreateMessage();
- message.ResponseClassifier = PipelineMessageClassifier200;
- var request = message.Request;
- request.Method = "GET";
- var uri = new ClientUriBuilder();
- uri.Reset(_endpoint);
- uri.AppendPath("/fine_tuning/jobs/", false);
- uri.AppendPath(fineTuningJobId, true);
- request.Uri = uri.ToUri();
- request.Headers.Set("Accept", "application/json");
- message.Apply(options);
- return message;
+ uri.AppendQuery("after", after, true);
}
-
- internal PipelineMessage CreateCancelFineTuningJobRequest(string fineTuningJobId, RequestOptions options)
+ if (limit != null)
{
- var message = _pipeline.CreateMessage();
- message.ResponseClassifier = PipelineMessageClassifier200;
- var request = message.Request;
- request.Method = "POST";
- var uri = new ClientUriBuilder();
- uri.Reset(_endpoint);
- uri.AppendPath("/fine_tuning/jobs/", false);
- uri.AppendPath(fineTuningJobId, true);
- uri.AppendPath("/cancel", false);
- request.Uri = uri.ToUri();
- request.Headers.Set("Accept", "application/json");
- message.Apply(options);
- return message;
+ uri.AppendQuery("limit", limit.Value, true);
}
+ request.Uri = uri.ToUri();
+ request.Headers.Set("Accept", "application/json");
+ message.Apply(options);
+ return message;
+ }
- internal PipelineMessage CreateGetFineTuningJobCheckpointsRequest(string fineTuningJobId, string after, int? limit, RequestOptions options)
+ internal PipelineMessage CreateGetFineTuningEventsRequest(string fineTuningJobId, string after, int? limit, RequestOptions options)
+ {
+ var message = _pipeline.CreateMessage();
+ message.ResponseClassifier = PipelineMessageClassifier200;
+ var request = message.Request;
+ request.Method = "GET";
+ var uri = new ClientUriBuilder();
+ uri.Reset(_endpoint);
+ uri.AppendPath("/fine_tuning/jobs/", false);
+ uri.AppendPath(fineTuningJobId, true);
+ uri.AppendPath("/events", false);
+ if (after != null)
{
- var message = _pipeline.CreateMessage();
- message.ResponseClassifier = PipelineMessageClassifier200;
- var request = message.Request;
- request.Method = "GET";
- var uri = new ClientUriBuilder();
- uri.Reset(_endpoint);
- uri.AppendPath("/fine_tuning/jobs/", false);
- uri.AppendPath(fineTuningJobId, true);
- uri.AppendPath("/checkpoints", false);
- if (after != null)
- {
- uri.AppendQuery("after", after, true);
- }
- if (limit != null)
- {
- uri.AppendQuery("limit", limit.Value, true);
- }
- request.Uri = uri.ToUri();
- request.Headers.Set("Accept", "application/json");
- message.Apply(options);
- return message;
+ uri.AppendQuery("after", after, true);
}
-
- internal PipelineMessage CreateGetFineTuningEventsRequest(string fineTuningJobId, string after, int? limit, RequestOptions options)
+ if (limit != null)
{
- var message = _pipeline.CreateMessage();
- message.ResponseClassifier = PipelineMessageClassifier200;
- var request = message.Request;
- request.Method = "GET";
- var uri = new ClientUriBuilder();
- uri.Reset(_endpoint);
- uri.AppendPath("/fine_tuning/jobs/", false);
- uri.AppendPath(fineTuningJobId, true);
- uri.AppendPath("/events", false);
- if (after != null)
- {
- uri.AppendQuery("after", after, true);
- }
- if (limit != null)
- {
- uri.AppendQuery("limit", limit.Value, true);
- }
- request.Uri = uri.ToUri();
- request.Headers.Set("Accept", "application/json");
- message.Apply(options);
- return message;
+ uri.AppendQuery("limit", limit.Value, true);
}
-
- private static PipelineMessageClassifier _pipelineMessageClassifier200;
- private static PipelineMessageClassifier PipelineMessageClassifier200 => _pipelineMessageClassifier200 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 200 });
+ request.Uri = uri.ToUri();
+ request.Headers.Set("Accept", "application/json");
+ message.Apply(options);
+ return message;
}
-}
+
+ private static PipelineMessageClassifier _pipelineMessageClassifier200;
+ private static PipelineMessageClassifier PipelineMessageClassifier200 => _pipelineMessageClassifier200 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 200 });
+}
\ No newline at end of file
diff --git a/src/Generated/ImageClient.cs b/src/Generated/ImageClient.cs
index 6e0558f0..1d5d314f 100644
--- a/src/Generated/ImageClient.cs
+++ b/src/Generated/ImageClient.cs
@@ -5,77 +5,75 @@
using System;
using System.ClientModel;
using System.ClientModel.Primitives;
-using System.Threading.Tasks;
-namespace OpenAI.Images
-{
- // Data plane generated sub-client.
- public partial class ImageClient
- {
- private const string AuthorizationHeader = "Authorization";
- private readonly ApiKeyCredential _keyCredential;
- private const string AuthorizationApiKeyPrefix = "Bearer";
- private readonly ClientPipeline _pipeline;
- private readonly Uri _endpoint;
+namespace OpenAI.Images;
- public virtual ClientPipeline Pipeline => _pipeline;
+// Data plane generated sub-client.
+public partial class ImageClient
+{
+ private const string AuthorizationHeader = "Authorization";
+ private readonly ApiKeyCredential _keyCredential;
+ private const string AuthorizationApiKeyPrefix = "Bearer";
+ private readonly ClientPipeline _pipeline;
+ private readonly Uri _endpoint;
- protected ImageClient()
- {
- }
+ public virtual ClientPipeline Pipeline => _pipeline;
- internal PipelineMessage CreateCreateImageRequest(BinaryContent content, RequestOptions options)
- {
- var message = _pipeline.CreateMessage();
- message.ResponseClassifier = PipelineMessageClassifier200;
- var request = message.Request;
- request.Method = "POST";
- var uri = new ClientUriBuilder();
- uri.Reset(_endpoint);
- uri.AppendPath("/images/generations", false);
- request.Uri = uri.ToUri();
- request.Headers.Set("Accept", "application/json");
- request.Headers.Set("Content-Type", "application/json");
- request.Content = content;
- message.Apply(options);
- return message;
- }
+ protected ImageClient()
+ {
+ }
- internal PipelineMessage CreateCreateImageEditRequest(BinaryContent content, string contentType, RequestOptions options)
- {
- var message = _pipeline.CreateMessage();
- message.ResponseClassifier = PipelineMessageClassifier200;
- var request = message.Request;
- request.Method = "POST";
- var uri = new ClientUriBuilder();
- uri.Reset(_endpoint);
- uri.AppendPath("/images/edits", false);
- request.Uri = uri.ToUri();
- request.Headers.Set("Accept", "application/json");
- request.Headers.Set("Content-Type", contentType);
- request.Content = content;
- message.Apply(options);
- return message;
- }
+ internal PipelineMessage CreateCreateImageRequest(BinaryContent content, RequestOptions options)
+ {
+ var message = _pipeline.CreateMessage();
+ message.ResponseClassifier = PipelineMessageClassifier200;
+ var request = message.Request;
+ request.Method = "POST";
+ var uri = new ClientUriBuilder();
+ uri.Reset(_endpoint);
+ uri.AppendPath("/images/generations", false);
+ request.Uri = uri.ToUri();
+ request.Headers.Set("Accept", "application/json");
+ request.Headers.Set("Content-Type", "application/json");
+ request.Content = content;
+ message.Apply(options);
+ return message;
+ }
- internal PipelineMessage CreateCreateImageVariationRequest(BinaryContent content, string contentType, RequestOptions options)
- {
- var message = _pipeline.CreateMessage();
- message.ResponseClassifier = PipelineMessageClassifier200;
- var request = message.Request;
- request.Method = "POST";
- var uri = new ClientUriBuilder();
- uri.Reset(_endpoint);
- uri.AppendPath("/images/variations", false);
- request.Uri = uri.ToUri();
- request.Headers.Set("Accept", "application/json");
- request.Headers.Set("Content-Type", contentType);
- request.Content = content;
- message.Apply(options);
- return message;
- }
+ internal PipelineMessage CreateCreateImageEditRequest(BinaryContent content, string contentType, RequestOptions options)
+ {
+ var message = _pipeline.CreateMessage();
+ message.ResponseClassifier = PipelineMessageClassifier200;
+ var request = message.Request;
+ request.Method = "POST";
+ var uri = new ClientUriBuilder();
+ uri.Reset(_endpoint);
+ uri.AppendPath("/images/edits", false);
+ request.Uri = uri.ToUri();
+ request.Headers.Set("Accept", "application/json");
+ request.Headers.Set("Content-Type", contentType);
+ request.Content = content;
+ message.Apply(options);
+ return message;
+ }
- private static PipelineMessageClassifier _pipelineMessageClassifier200;
- private static PipelineMessageClassifier PipelineMessageClassifier200 => _pipelineMessageClassifier200 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 200 });
+ internal PipelineMessage CreateCreateImageVariationRequest(BinaryContent content, string contentType, RequestOptions options)
+ {
+ var message = _pipeline.CreateMessage();
+ message.ResponseClassifier = PipelineMessageClassifier200;
+ var request = message.Request;
+ request.Method = "POST";
+ var uri = new ClientUriBuilder();
+ uri.Reset(_endpoint);
+ uri.AppendPath("/images/variations", false);
+ request.Uri = uri.ToUri();
+ request.Headers.Set("Accept", "application/json");
+ request.Headers.Set("Content-Type", contentType);
+ request.Content = content;
+ message.Apply(options);
+ return message;
}
-}
+
+ private static PipelineMessageClassifier _pipelineMessageClassifier200;
+ private static PipelineMessageClassifier PipelineMessageClassifier200 => _pipelineMessageClassifier200 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 200 });
+}
\ No newline at end of file
diff --git a/src/Generated/Internal/Argument.cs b/src/Generated/Internal/Argument.cs
index 29cb5ac1..cb34ba36 100644
--- a/src/Generated/Internal/Argument.cs
+++ b/src/Generated/Internal/Argument.cs
@@ -6,121 +6,120 @@
using System.Collections;
using System.Collections.Generic;
-namespace OpenAI
+namespace OpenAI;
+
+internal static class Argument
{
- internal static class Argument
+ public static void AssertNotNull(T value, string name)
{
- public static void AssertNotNull(T value, string name)
+ if (value is null)
{
- if (value is null)
- {
- throw new ArgumentNullException(name);
- }
+ throw new ArgumentNullException(name);
}
+ }
- public static void AssertNotNull(T? value, string name)
- where T : struct
+ public static void AssertNotNull(T? value, string name)
+ where T : struct
+ {
+ if (!value.HasValue)
{
- if (!value.HasValue)
- {
- throw new ArgumentNullException(name);
- }
+ throw new ArgumentNullException(name);
}
+ }
- public static void AssertNotNullOrEmpty(IEnumerable value, string name)
+ public static void AssertNotNullOrEmpty(IEnumerable value, string name)
+ {
+ if (value is null)
{
- if (value is null)
- {
- throw new ArgumentNullException(name);
- }
- if (value is ICollection collectionOfT && collectionOfT.Count == 0)
- {
- throw new ArgumentException("Value cannot be an empty collection.", name);
- }
- if (value is ICollection collection && collection.Count == 0)
- {
- throw new ArgumentException("Value cannot be an empty collection.", name);
- }
- using IEnumerator e = value.GetEnumerator();
- if (!e.MoveNext())
- {
- throw new ArgumentException("Value cannot be an empty collection.", name);
- }
+ throw new ArgumentNullException(name);
}
-
- public static void AssertNotNullOrEmpty(string value, string name)
+ if (value is ICollection collectionOfT && collectionOfT.Count == 0)
{
- if (value is null)
- {
- throw new ArgumentNullException(name);
- }
- if (value.Length == 0)
- {
- throw new ArgumentException("Value cannot be an empty string.", name);
- }
+ throw new ArgumentException("Value cannot be an empty collection.", name);
}
-
- public static void AssertNotNullOrWhiteSpace(string value, string name)
+ if (value is ICollection collection && collection.Count == 0)
+ {
+ throw new ArgumentException("Value cannot be an empty collection.", name);
+ }
+ using IEnumerator e = value.GetEnumerator();
+ if (!e.MoveNext())
{
- if (value is null)
- {
- throw new ArgumentNullException(name);
- }
- if (string.IsNullOrWhiteSpace(value))
- {
- throw new ArgumentException("Value cannot be empty or contain only white-space characters.", name);
- }
+ throw new ArgumentException("Value cannot be an empty collection.", name);
}
+ }
- public static void AssertNotDefault(ref T value, string name)
- where T : struct, IEquatable
+ public static void AssertNotNullOrEmpty(string value, string name)
+ {
+ if (value is null)
+ {
+ throw new ArgumentNullException(name);
+ }
+ if (value.Length == 0)
{
- if (value.Equals(default))
- {
- throw new ArgumentException("Value cannot be empty.", name);
- }
+ throw new ArgumentException("Value cannot be an empty string.", name);
}
+ }
- public static void AssertInRange(T value, T minimum, T maximum, string name)
- where T : notnull, IComparable
+ public static void AssertNotNullOrWhiteSpace(string value, string name)
+ {
+ if (value is null)
+ {
+ throw new ArgumentNullException(name);
+ }
+ if (string.IsNullOrWhiteSpace(value))
{
- if (minimum.CompareTo(value) > 0)
- {
- throw new ArgumentOutOfRangeException(name, "Value is less than the minimum allowed.");
- }
- if (maximum.CompareTo(value) < 0)
- {
- throw new ArgumentOutOfRangeException(name, "Value is greater than the maximum allowed.");
- }
+ throw new ArgumentException("Value cannot be empty or contain only white-space characters.", name);
}
+ }
- public static void AssertEnumDefined(Type enumType, object value, string name)
+ public static void AssertNotDefault(ref T value, string name)
+ where T : struct, IEquatable
+ {
+ if (value.Equals(default))
{
- if (!Enum.IsDefined(enumType, value))
- {
- throw new ArgumentException($"Value not defined for {enumType.FullName}.", name);
- }
+ throw new ArgumentException("Value cannot be empty.", name);
}
+ }
- public static T CheckNotNull(T value, string name)
- where T : class
+ public static void AssertInRange(T value, T minimum, T maximum, string name)
+ where T : notnull, IComparable
+ {
+ if (minimum.CompareTo(value) > 0)
{
- AssertNotNull(value, name);
- return value;
+ throw new ArgumentOutOfRangeException(name, "Value is less than the minimum allowed.");
}
+ if (maximum.CompareTo(value) < 0)
+ {
+ throw new ArgumentOutOfRangeException(name, "Value is greater than the maximum allowed.");
+ }
+ }
- public static string CheckNotNullOrEmpty(string value, string name)
+ public static void AssertEnumDefined(Type enumType, object value, string name)
+ {
+ if (!Enum.IsDefined(enumType, value))
{
- AssertNotNullOrEmpty(value, name);
- return value;
+ throw new ArgumentException($"Value not defined for {enumType.FullName}.", name);
}
+ }
+
+ public static T CheckNotNull(T value, string name)
+ where T : class
+ {
+ AssertNotNull(value, name);
+ return value;
+ }
- public static void AssertNull(T value, string name, string message = null)
+ public static string CheckNotNullOrEmpty(string value, string name)
+ {
+ AssertNotNullOrEmpty(value, name);
+ return value;
+ }
+
+ public static void AssertNull(T value, string name, string message = null)
+ {
+ if (value != null)
{
- if (value != null)
- {
- throw new ArgumentException(message ?? "Value must be null.", name);
- }
+ throw new ArgumentException(message ?? "Value must be null.", name);
}
}
-}
+}
\ No newline at end of file
diff --git a/src/Generated/Internal/BinaryContentHelper.cs b/src/Generated/Internal/BinaryContentHelper.cs
index 52bcdbdf..c90621af 100644
--- a/src/Generated/Internal/BinaryContentHelper.cs
+++ b/src/Generated/Internal/BinaryContentHelper.cs
@@ -7,127 +7,126 @@
using System.Collections.Generic;
using System.Text.Json;
-namespace OpenAI
+namespace OpenAI;
+
+internal static class BinaryContentHelper
{
- internal static class BinaryContentHelper
+ public static BinaryContent FromEnumerable(IEnumerable enumerable)
+ where T : notnull
{
- public static BinaryContent FromEnumerable(IEnumerable enumerable)
- where T : notnull
+ Utf8JsonBinaryContent content = new Utf8JsonBinaryContent();
+ content.JsonWriter.WriteStartArray();
+ foreach (var item in enumerable)
{
- Utf8JsonBinaryContent content = new Utf8JsonBinaryContent();
- content.JsonWriter.WriteStartArray();
- foreach (var item in enumerable)
- {
- content.JsonWriter.WriteObjectValue(item, ModelSerializationExtensions.WireOptions);
- }
- content.JsonWriter.WriteEndArray();
-
- return content;
+ content.JsonWriter.WriteObjectValue(item, ModelSerializationExtensions.WireOptions);
}
+ content.JsonWriter.WriteEndArray();
- public static BinaryContent FromEnumerable(IEnumerable enumerable)
+ return content;
+ }
+
+ public static BinaryContent FromEnumerable(IEnumerable enumerable)
+ {
+ Utf8JsonBinaryContent content = new Utf8JsonBinaryContent();
+ content.JsonWriter.WriteStartArray();
+ foreach (var item in enumerable)
{
- Utf8JsonBinaryContent content = new Utf8JsonBinaryContent();
- content.JsonWriter.WriteStartArray();
- foreach (var item in enumerable)
+ if (item == null)
+ {
+ content.JsonWriter.WriteNullValue();
+ }
+ else
{
- if (item == null)
- {
- content.JsonWriter.WriteNullValue();
- }
- else
- {
#if NET6_0_OR_GREATER
content.JsonWriter.WriteRawValue(item);
#else
- using (JsonDocument document = JsonDocument.Parse(item))
- {
- JsonSerializer.Serialize(content.JsonWriter, document.RootElement);
- }
-#endif
+ using (JsonDocument document = JsonDocument.Parse(item))
+ {
+ JsonSerializer.Serialize(content.JsonWriter, document.RootElement);
}
+#endif
}
- content.JsonWriter.WriteEndArray();
-
- return content;
}
+ content.JsonWriter.WriteEndArray();
- public static BinaryContent FromEnumerable(ReadOnlySpan span)
- where T : notnull
- {
- Utf8JsonBinaryContent content = new Utf8JsonBinaryContent();
- content.JsonWriter.WriteStartArray();
- for (int i = 0; i < span.Length; i++)
- {
- content.JsonWriter.WriteObjectValue(span[i], ModelSerializationExtensions.WireOptions);
- }
- content.JsonWriter.WriteEndArray();
+ return content;
+ }
- return content;
+ public static BinaryContent FromEnumerable(ReadOnlySpan span)
+ where T : notnull
+ {
+ Utf8JsonBinaryContent content = new Utf8JsonBinaryContent();
+ content.JsonWriter.WriteStartArray();
+ for (int i = 0; i < span.Length; i++)
+ {
+ content.JsonWriter.WriteObjectValue(span[i], ModelSerializationExtensions.WireOptions);
}
+ content.JsonWriter.WriteEndArray();
- public static BinaryContent FromDictionary(IDictionary dictionary)
- where TValue : notnull
- {
- Utf8JsonBinaryContent content = new Utf8JsonBinaryContent();
- content.JsonWriter.WriteStartObject();
- foreach (var item in dictionary)
- {
- content.JsonWriter.WritePropertyName(item.Key);
- content.JsonWriter.WriteObjectValue(item.Value, ModelSerializationExtensions.WireOptions);
- }
- content.JsonWriter.WriteEndObject();
+ return content;
+ }
- return content;
+ public static BinaryContent FromDictionary(IDictionary dictionary)
+ where TValue : notnull
+ {
+ Utf8JsonBinaryContent content = new Utf8JsonBinaryContent();
+ content.JsonWriter.WriteStartObject();
+ foreach (var item in dictionary)
+ {
+ content.JsonWriter.WritePropertyName(item.Key);
+ content.JsonWriter.WriteObjectValue(item.Value, ModelSerializationExtensions.WireOptions);
}
+ content.JsonWriter.WriteEndObject();
+
+ return content;
+ }
- public static BinaryContent FromDictionary(IDictionary dictionary)
+ public static BinaryContent FromDictionary(IDictionary dictionary)
+ {
+ Utf8JsonBinaryContent content = new Utf8JsonBinaryContent();
+ content.JsonWriter.WriteStartObject();
+ foreach (var item in dictionary)
{
- Utf8JsonBinaryContent content = new Utf8JsonBinaryContent();
- content.JsonWriter.WriteStartObject();
- foreach (var item in dictionary)
+ content.JsonWriter.WritePropertyName(item.Key);
+ if (item.Value == null)
+ {
+ content.JsonWriter.WriteNullValue();
+ }
+ else
{
- content.JsonWriter.WritePropertyName(item.Key);
- if (item.Value == null)
- {
- content.JsonWriter.WriteNullValue();
- }
- else
- {
#if NET6_0_OR_GREATER
content.JsonWriter.WriteRawValue(item.Value);
#else
- using (JsonDocument document = JsonDocument.Parse(item.Value))
- {
- JsonSerializer.Serialize(content.JsonWriter, document.RootElement);
- }
-#endif
+ using (JsonDocument document = JsonDocument.Parse(item.Value))
+ {
+ JsonSerializer.Serialize(content.JsonWriter, document.RootElement);
}
+#endif
}
- content.JsonWriter.WriteEndObject();
-
- return content;
}
+ content.JsonWriter.WriteEndObject();
- public static BinaryContent FromObject(object value)
- {
- Utf8JsonBinaryContent content = new Utf8JsonBinaryContent();
- content.JsonWriter.WriteObjectValue