diff --git a/src/Custom/Assistants/FileSearchToolResources.cs b/src/Custom/Assistants/FileSearchToolResources.cs index 7c7805341..52c24b16f 100644 --- a/src/Custom/Assistants/FileSearchToolResources.cs +++ b/src/Custom/Assistants/FileSearchToolResources.cs @@ -30,7 +30,7 @@ public IList VectorStoreIds public FileSearchToolResources() { } - private void SerializeNewVectorStores(Utf8JsonWriter writer) - => writer.WriteObjectValue(NewVectorStores, new ModelReaderWriterOptions("J")); + private void SerializeNewVectorStores(Utf8JsonWriter writer, ModelReaderWriterOptions options) + => writer.WriteObjectValue(NewVectorStores, options); } diff --git a/src/Custom/Assistants/GeneratorStubs.cs b/src/Custom/Assistants/GeneratorStubs.cs index ab1bb1ff9..8961646e9 100644 --- a/src/Custom/Assistants/GeneratorStubs.cs +++ b/src/Custom/Assistants/GeneratorStubs.cs @@ -8,13 +8,13 @@ [CodeGenModel("AssistantToolsCode")] public partial class CodeInterpreterToolDefinition : ToolDefinition { } -[CodeGenModel("ThreadMessageStatus")] +[CodeGenModel("MessageObjectStatus")] public readonly partial struct MessageStatus { } [CodeGenModel("MessageObjectIncompleteDetails")] public partial class MessageFailureDetails { } -[CodeGenModel("MessageFailureDetailsReason")] +[CodeGenModel("MessageObjectIncompleteDetailsReason")] public readonly partial struct MessageFailureReason { } [CodeGenModel("RunCompletionUsage")] @@ -23,25 +23,25 @@ public partial class RunTokenUsage { } [CodeGenModel("RunObjectLastError")] public partial class RunError { } -[CodeGenModel("RunErrorCode")] +[CodeGenModel("RunObjectLastErrorCode")] public readonly partial struct RunErrorCode { } [CodeGenModel("RunObjectIncompleteDetails")] public partial class RunIncompleteDetails { } -[CodeGenModel("RunIncompleteDetailsReason")] +[CodeGenModel("RunObjectIncompleteDetailsReason")] public readonly partial struct RunIncompleteReason { } -[CodeGenModel("RunStepType")] +[CodeGenModel("RunStepObjectType")] public readonly partial struct RunStepType { } -[CodeGenModel("RunStepStatus")] +[CodeGenModel("RunStepObjectStatus")] public readonly partial struct RunStepStatus { } [CodeGenModel("RunStepObjectLastError")] public partial class RunStepError { } -[CodeGenModel("RunStepErrorCode")] +[CodeGenModel("RunStepObjectLastErrorCode")] public readonly partial struct RunStepErrorCode { } [CodeGenModel("RunStepCompletionUsage")] diff --git a/src/Custom/Assistants/Internal/GeneratorStubs.Internal.cs b/src/Custom/Assistants/Internal/GeneratorStubs.Internal.cs index 5a521d7cb..70b189b09 100644 --- a/src/Custom/Assistants/Internal/GeneratorStubs.Internal.cs +++ b/src/Custom/Assistants/Internal/GeneratorStubs.Internal.cs @@ -34,10 +34,10 @@ internal partial class MessageDeltaContentImageUrlObjectImageUrl } [CodeGenModel("MessageDeltaContentImageFileObject")] -internal partial class MessageDeltaContentImageFileObject { private readonly new string Type; } +internal partial class MessageDeltaContentImageFileObject { } [CodeGenModel("MessageDeltaContentImageUrlObject")] -internal partial class MessageDeltaContentImageUrlObject { private readonly new string Type; } +internal partial class MessageDeltaContentImageUrlObject { } [CodeGenModel("MessageDeltaObjectDelta")] internal partial class MessageDeltaObjectDelta @@ -207,8 +207,8 @@ internal readonly partial struct InternalListRunStepsResponseObject {} [CodeGenModel("RunStepDetailsToolCallsFileSearchObject")] internal partial class InternalRunStepFileSearchToolCallDetails { } -[CodeGenModel("RunTruncationStrategyType")] -internal readonly partial struct InternalRunTruncationStrategyType { } +[CodeGenModel("TruncationObjectType")] +internal readonly partial struct InternalTruncationObjectType { } [CodeGenModel("AssistantsNamedToolChoiceType")] internal readonly partial struct InternalAssistantsNamedToolChoiceType { } @@ -268,15 +268,12 @@ internal partial class InternalRunStepDeltaStepDetailsToolCallsFunctionObjectFun [CodeGenModel("AssistantsApiResponseFormat")] internal partial class InternalAssistantsApiResponseFormat { } -[CodeGenModel("InternalAssistantsApiResponseFormatType")] +[CodeGenModel("AssistantsApiResponseFormatType")] internal readonly partial struct InternalAssistantsApiResponseFormatType { } [CodeGenModel("AssistantsNamedToolChoiceFunction")] internal partial class InternalAssistantsNamedToolChoiceFunction { } -[CodeGenModel("ToolConstraintType")] -internal readonly partial struct InternalToolConstraintType { } - [CodeGenModel("AssistantObjectObject")] internal readonly partial struct InternalAssistantObjectObject { } @@ -295,11 +292,11 @@ internal readonly partial struct InternalThreadObjectObject { } [CodeGenModel("MessageRequestContentTextObjectType")] internal readonly partial struct InternalMessageRequestContentTextObjectType { } -[CodeGenModel("InternalMessageContentImageUrlObjectImageUrlDetail")] +[CodeGenModel("MessageContentImageUrlObjectImageUrlDetail")] internal readonly partial struct InternalMessageContentImageUrlObjectImageUrlDetail { } -[CodeGenModel("InternalMessageContentItemFileObjectImageFileDetail")] -internal readonly partial struct InternalMessageContentItemFileObjectImageFileDetail { } +[CodeGenModel("MessageContentImageFileObjectImageFileDetail")] +internal readonly partial struct InternalMessageContentImageFileObjectImageFileDetail { } [CodeGenModel("MessageDeltaContentImageFileObjectImageFileDetail")] internal readonly partial struct InternalMessageDeltaContentImageFileObjectImageFileDetail { } @@ -337,8 +334,8 @@ internal readonly partial struct InternalRunStepDeltaObjectObject { } [CodeGenModel("RunToolCallObjectType")] internal readonly partial struct InternalRunToolCallObjectType { } -[CodeGenModel("ThreadMessageRole")] -internal readonly partial struct InternalThreadMessageRole { } +[CodeGenModel("MessageObjectRole")] +internal readonly partial struct InternalMessageObjectRole { } [CodeGenModel("CreateRunRequestModel")] internal readonly partial struct InternalCreateRunRequestModel { } @@ -346,6 +343,9 @@ internal readonly partial struct InternalCreateRunRequestModel { } [CodeGenModel("CreateThreadAndRunRequestModel")] internal readonly partial struct InternalCreateThreadAndRunRequestModel { } +[CodeGenModel("CreateAssistantRequestResponseFormat")] +internal readonly partial struct InternalCreateAssistantRequestResponseFormat { } + [CodeGenModel("CreateAssistantRequestToolResources")] internal partial class InternalCreateAssistantRequestToolResources { } @@ -361,6 +361,9 @@ internal partial class InternalCreateAssistantRequestToolResourcesFileSearchVect [CodeGenModel("CreateAssistantRequestToolResourcesFileSearchVectorStoreIdReferences")] internal partial class InternalCreateAssistantRequestToolResourcesFileSearchVectorStoreIdReferences { } +[CodeGenModel("CreateThreadAndRunRequestToolChoice")] +internal readonly partial struct InternalCreateThreadAndRunRequestToolChoice { } + [CodeGenModel("CreateThreadAndRunRequestToolResources")] internal partial class InternalCreateThreadAndRunRequestToolResources { } @@ -416,4 +419,7 @@ internal partial class InternalThreadObjectToolResourcesCodeInterpreter { } internal partial class InternalThreadObjectToolResourcesFileSearch { } [CodeGenModel("AssistantToolsFileSearchTypeOnly")] -internal readonly partial struct InternalAssistantToolsFileSearchTypeOnly { } \ No newline at end of file +internal partial class InternalAssistantToolsFileSearchTypeOnly { } + +[CodeGenModel("AssistantToolsFileSearchTypeOnlyType")] +internal readonly partial struct InternalAssistantToolsFileSearchTypeOnlyType { } diff --git a/src/Custom/Assistants/MessageCreationAttachment.cs b/src/Custom/Assistants/MessageCreationAttachment.cs index 41706d2d7..46827002a 100644 --- a/src/Custom/Assistants/MessageCreationAttachment.cs +++ b/src/Custom/Assistants/MessageCreationAttachment.cs @@ -1,3 +1,4 @@ +using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; @@ -22,8 +23,8 @@ public partial class MessageCreationAttachment [CodeGenMember("Tools")] public IReadOnlyList Tools { get; } = new ChangeTrackingList(); - private void SerializeTools(Utf8JsonWriter writer) - => writer.WriteObjectValue(Tools); + private void SerializeTools(Utf8JsonWriter writer, ModelReaderWriterOptions options) + => writer.WriteObjectValue(Tools, options); private static void DeserializeTools(JsonProperty property, ref IReadOnlyList tools) { diff --git a/src/Custom/Assistants/MessageRole.cs b/src/Custom/Assistants/MessageRole.cs index 4a0dae147..6aae4c418 100644 --- a/src/Custom/Assistants/MessageRole.cs +++ b/src/Custom/Assistants/MessageRole.cs @@ -1,6 +1,6 @@ namespace OpenAI.Assistants; -[CodeGenModel("MessageCreationOptionsRole")] +[CodeGenModel("CreateMessageRequestRole")] public enum MessageRole { /// diff --git a/src/Custom/Assistants/RunCreationOptions.cs b/src/Custom/Assistants/RunCreationOptions.cs index 820fef20b..32797f135 100644 --- a/src/Custom/Assistants/RunCreationOptions.cs +++ b/src/Custom/Assistants/RunCreationOptions.cs @@ -133,6 +133,6 @@ private set public RunCreationOptions() { } - private void SerializeToolConstraint(Utf8JsonWriter writer) - => writer.WriteObjectValue(ToolConstraint, new ModelReaderWriterOptions("J")); + private void SerializeToolConstraint(Utf8JsonWriter writer, ModelReaderWriterOptions options) + => writer.WriteObjectValue(ToolConstraint, options); } \ No newline at end of file diff --git a/src/Custom/Assistants/RunStatus.cs b/src/Custom/Assistants/RunStatus.cs index fc521ea7f..b2b5da90e 100644 --- a/src/Custom/Assistants/RunStatus.cs +++ b/src/Custom/Assistants/RunStatus.cs @@ -1,6 +1,6 @@ namespace OpenAI.Assistants; -[CodeGenModel("ThreadRunStatus")] +[CodeGenModel("RunObjectStatus")] public readonly partial struct RunStatus { /// diff --git a/src/Custom/Assistants/RunTruncationStrategy.cs b/src/Custom/Assistants/RunTruncationStrategy.cs index ec2a2bce6..d2bdea5ff 100644 --- a/src/Custom/Assistants/RunTruncationStrategy.cs +++ b/src/Custom/Assistants/RunTruncationStrategy.cs @@ -5,7 +5,7 @@ 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. [CodeGenModel("TruncationObject")] - [CodeGenSuppress(nameof(RunTruncationStrategy), typeof(InternalRunTruncationStrategyType))] + [CodeGenSuppress(nameof(RunTruncationStrategy), typeof(InternalTruncationObjectType))] public partial class RunTruncationStrategy { /// @@ -42,7 +42,7 @@ public partial class RunTruncationStrategy /// 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 InternalRunTruncationStrategyType _type; + internal readonly InternalTruncationObjectType _type; /// The number of most recent messages from the thread when constructing the context for the run. /// @@ -54,7 +54,7 @@ public partial class RunTruncationStrategy /// 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(InternalRunTruncationStrategyType.Auto, 0, null); + public static RunTruncationStrategy Auto { get; } = new(InternalTruncationObjectType.Auto, 0, null); /// /// Creates a new instance using the last_messages strategy type, @@ -63,6 +63,6 @@ public partial class RunTruncationStrategy /// The count of last messages that the run should evaluate. /// public static RunTruncationStrategy CreateLastMessagesStrategy(int lastMessageCount) - => new(InternalRunTruncationStrategyType.LastMessages, lastMessageCount, null); + => new(InternalTruncationObjectType.LastMessages, lastMessageCount, null); } } diff --git a/src/Custom/Assistants/ThreadRun.cs b/src/Custom/Assistants/ThreadRun.cs index ace763167..9d8ac1402 100644 --- a/src/Custom/Assistants/ThreadRun.cs +++ b/src/Custom/Assistants/ThreadRun.cs @@ -1,4 +1,6 @@ +using System; using System.Collections.Generic; +using System.Linq; namespace OpenAI.Assistants; @@ -18,6 +20,43 @@ public partial class ThreadRun [CodeGenMember("RequiredAction")] internal readonly InternalRunRequiredAction _internalRequiredAction; + // CUSTOM: Removed null check for `toolConstraint` and `responseFormat`. + internal ThreadRun(string id, DateTimeOffset createdAt, string threadId, string assistantId, RunStatus status, InternalRunRequiredAction internalRequiredAction, RunError lastError, DateTimeOffset? expiresAt, DateTimeOffset? startedAt, DateTimeOffset? cancelledAt, DateTimeOffset? failedAt, DateTimeOffset? completedAt, RunIncompleteDetails incompleteDetails, string model, string instructions, IEnumerable tools, IReadOnlyDictionary metadata, RunTokenUsage usage, int? maxPromptTokens, int? maxCompletionTokens, RunTruncationStrategy truncationStrategy, ToolConstraint toolConstraint, bool? parallelToolCallsEnabled, AssistantResponseFormat responseFormat) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(threadId, nameof(threadId)); + Argument.AssertNotNull(assistantId, nameof(assistantId)); + Argument.AssertNotNull(model, nameof(model)); + Argument.AssertNotNull(instructions, nameof(instructions)); + Argument.AssertNotNull(tools, nameof(tools)); + + Id = id; + CreatedAt = createdAt; + ThreadId = threadId; + AssistantId = assistantId; + Status = status; + _internalRequiredAction = internalRequiredAction; + LastError = lastError; + ExpiresAt = expiresAt; + StartedAt = startedAt; + CancelledAt = cancelledAt; + FailedAt = failedAt; + CompletedAt = completedAt; + IncompleteDetails = incompleteDetails; + Model = model; + Instructions = instructions; + Tools = tools.ToList(); + Metadata = metadata; + Usage = usage; + MaxPromptTokens = maxPromptTokens; + MaxCompletionTokens = maxCompletionTokens; + TruncationStrategy = truncationStrategy; + ToolConstraint = toolConstraint; + ParallelToolCallsEnabled = parallelToolCallsEnabled; + ResponseFormat = responseFormat; + } + + /// /// The list of required actions that must have their results submitted for the run to continue. /// diff --git a/src/Custom/Assistants/ToolResources.cs b/src/Custom/Assistants/ToolResources.cs index 614979a66..93b2b7388 100644 --- a/src/Custom/Assistants/ToolResources.cs +++ b/src/Custom/Assistants/ToolResources.cs @@ -15,6 +15,6 @@ public partial class ToolResources public ToolResources() {} - private void SerializeFileSearch(Utf8JsonWriter writer) - => writer.WriteObjectValue(FileSearch, new ModelReaderWriterOptions("J")); + private void SerializeFileSearch(Utf8JsonWriter writer, ModelReaderWriterOptions options) + => writer.WriteObjectValue(FileSearch, options); } diff --git a/src/Custom/Audio/AudioTimestampGranularity.cs b/src/Custom/Audio/AudioTimestampGranularities.cs similarity index 100% rename from src/Custom/Audio/AudioTimestampGranularity.cs rename to src/Custom/Audio/AudioTimestampGranularities.cs diff --git a/src/Custom/Audio/AudioTranscriptionFormat.cs b/src/Custom/Audio/AudioTranscriptionFormat.cs index 2573d1064..3757026c6 100644 --- a/src/Custom/Audio/AudioTranscriptionFormat.cs +++ b/src/Custom/Audio/AudioTranscriptionFormat.cs @@ -5,7 +5,7 @@ namespace OpenAI.Audio; /// /// Specifies the format of the audio transcription. /// -[CodeGenModel("AudioTranscriptionOptionsResponseFormat")] +[CodeGenModel("CreateTranscriptionRequestResponseFormat")] public enum AudioTranscriptionFormat { /// Text. diff --git a/src/Custom/Audio/AudioTranslationFormat.cs b/src/Custom/Audio/AudioTranslationFormat.cs index edf569d2e..29e60faa2 100644 --- a/src/Custom/Audio/AudioTranslationFormat.cs +++ b/src/Custom/Audio/AudioTranslationFormat.cs @@ -5,7 +5,7 @@ namespace OpenAI.Audio; /// /// Specifies the format of the audio translation. /// -[CodeGenModel("AudioTranslationOptionsResponseFormat")] +[CodeGenModel("CreateTranslationRequestResponseFormat")] public enum AudioTranslationFormat { /// Text. diff --git a/src/Custom/Audio/GeneratedSpeechFormat.cs b/src/Custom/Audio/GeneratedSpeechFormat.cs index 07e727132..4559bca96 100644 --- a/src/Custom/Audio/GeneratedSpeechFormat.cs +++ b/src/Custom/Audio/GeneratedSpeechFormat.cs @@ -3,7 +3,7 @@ namespace OpenAI.Audio; /// /// Represents an audio data format available as either input or output into an audio operation. /// -[CodeGenModel("SpeechGenerationOptionsResponseFormat")] +[CodeGenModel("CreateSpeechRequestResponseFormat")] public enum GeneratedSpeechFormat { /// MP3. /// diff --git a/src/Custom/Audio/GeneratedSpeechVoice.cs b/src/Custom/Audio/GeneratedSpeechVoice.cs index 1bf8770dc..d0aa0653c 100644 --- a/src/Custom/Audio/GeneratedSpeechVoice.cs +++ b/src/Custom/Audio/GeneratedSpeechVoice.cs @@ -5,7 +5,7 @@ namespace OpenAI.Audio; /// /// Represents the available text-to-speech voices. /// -[CodeGenModel("SpeechGenerationOptionsVoice")] +[CodeGenModel("CreateSpeechRequestVoice")] public enum GeneratedSpeechVoice { /// Alloy. diff --git a/src/Custom/Audio/Internal/GeneratorStubs.cs b/src/Custom/Audio/Internal/GeneratorStubs.cs index db8cb1ada..9f0082d56 100644 --- a/src/Custom/Audio/Internal/GeneratorStubs.cs +++ b/src/Custom/Audio/Internal/GeneratorStubs.cs @@ -8,6 +8,9 @@ internal readonly partial struct InternalCreateSpeechRequestModel { } [CodeGenModel("CreateTranscriptionRequestModel")] internal readonly partial struct InternalCreateTranscriptionRequestModel { } +[CodeGenModel("CreateTranscriptionRequestTimestampGranularity")] +internal readonly partial struct InternalCreateTranscriptionRequestTimestampGranularity { } + [CodeGenModel("CreateTranscriptionResponseJson")] internal partial class InternalCreateTranscriptionResponseJson { } diff --git a/src/Custom/Batch/BatchClient.cs b/src/Custom/Batch/BatchClient.cs index 0e5e79ffc..adce1b0d1 100644 --- a/src/Custom/Batch/BatchClient.cs +++ b/src/Custom/Batch/BatchClient.cs @@ -8,8 +8,8 @@ namespace OpenAI.Batch; [CodeGenClient("Batches")] [CodeGenSuppress("BatchClient", typeof(ClientPipeline), typeof(ApiKeyCredential), typeof(Uri))] -[CodeGenSuppress("CreateBatch", typeof(string), typeof(InternalBatchOperationEndpoint), typeof(InternalBatchCompletionTimeframe), typeof(IDictionary))] -[CodeGenSuppress("CreateBatchAsync", typeof(string), typeof(InternalBatchOperationEndpoint), typeof(InternalBatchCompletionTimeframe), typeof(IDictionary))] +[CodeGenSuppress("CreateBatch", typeof(string), typeof(InternalCreateBatchRequestEndpoint), typeof(InternalBatchCompletionTimeframe), typeof(IDictionary))] +[CodeGenSuppress("CreateBatchAsync", typeof(string), typeof(InternalCreateBatchRequestEndpoint), typeof(InternalBatchCompletionTimeframe), typeof(IDictionary))] [CodeGenSuppress("RetrieveBatch", typeof(string))] [CodeGenSuppress("RetrieveBatchAsync", typeof(string))] [CodeGenSuppress("RetrieveBatch", typeof(string), typeof(RequestOptions))] diff --git a/src/Custom/Batch/Internal/GeneratorStubs.cs b/src/Custom/Batch/Internal/GeneratorStubs.cs index a18bf2bf6..a3675b6f1 100644 --- a/src/Custom/Batch/Internal/GeneratorStubs.cs +++ b/src/Custom/Batch/Internal/GeneratorStubs.cs @@ -17,15 +17,9 @@ internal readonly partial struct InternalBatchErrorsObject { } [CodeGenModel("Batch")] internal partial class InternalBatchJob { } -[CodeGenModel("InternalBatchJobStatus")] -internal readonly partial struct InternalBatchJobStatus {} - [CodeGenModel("BatchObject")] internal readonly partial struct InternalBatchObject { } -[CodeGenModel("InternalCreateBatchRequestEndpoint")] -internal readonly partial struct InternalBatchOperationEndpoint { } - [CodeGenModel("BatchRequestCounts")] internal partial class InternalBatchRequestCounts { } @@ -44,9 +38,15 @@ internal partial class InternalBatchRequestOutputError { } [CodeGenModel("BatchRequestOutputResponse")] internal partial class InternalBatchRequestOutputResponse { } +[CodeGenModel("BatchStatus")] +internal readonly partial struct InternalBatchStatus { } + [CodeGenModel("CreateBatchRequest")] internal partial class InternalCreateBatchRequest { } +[CodeGenModel("CreateBatchRequestEndpoint")] +internal readonly partial struct InternalCreateBatchRequestEndpoint { } + [CodeGenModel("ListBatchesResponse")] internal partial class InternalListBatchesResponse { } diff --git a/src/Custom/Chat/ChatCompletionOptions.Serialization.cs b/src/Custom/Chat/ChatCompletionOptions.Serialization.cs index 63e2dd7db..a52c1eaf5 100644 --- a/src/Custom/Chat/ChatCompletionOptions.Serialization.cs +++ b/src/Custom/Chat/ChatCompletionOptions.Serialization.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System.ClientModel.Primitives; +using System.Collections.Generic; using System.Globalization; using System.Runtime.CompilerServices; using System.Text.Json; @@ -9,7 +10,7 @@ public partial class ChatCompletionOptions { // CUSTOM: Added custom serialization to treat a single string as a collection of strings with one item. [MethodImpl(MethodImplOptions.AggressiveInlining)] - private void SerializeStopSequencesValue(Utf8JsonWriter writer) + private void SerializeStopSequencesValue(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartArray(); foreach (var item in StopSequences) @@ -45,7 +46,7 @@ private static void DeserializeStopSequencesValue(JsonProperty property, ref ILi // CUSTOM: Added custom serialization to represent tokens as integers instead of strings. [MethodImpl(MethodImplOptions.AggressiveInlining)] - private void SerializeLogitBiasesValue(Utf8JsonWriter writer) + private void SerializeLogitBiasesValue(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); foreach (var item in LogitBiases) diff --git a/src/Custom/Chat/ChatFinishReason.cs b/src/Custom/Chat/ChatFinishReason.cs index b6ed54681..40e4bc9b7 100644 --- a/src/Custom/Chat/ChatFinishReason.cs +++ b/src/Custom/Chat/ChatFinishReason.cs @@ -37,7 +37,7 @@ namespace OpenAI.Chat; /// /// /// -[CodeGenModel("InternalCreateChatCompletionResponseChoiceFinishReason")] +[CodeGenModel("CreateChatCompletionResponseChoiceFinishReason")] public enum ChatFinishReason { /// diff --git a/src/Custom/Chat/ChatFunctionChoice.cs b/src/Custom/Chat/ChatFunctionChoice.cs index b6c69d510..276a8cc78 100644 --- a/src/Custom/Chat/ChatFunctionChoice.cs +++ b/src/Custom/Chat/ChatFunctionChoice.cs @@ -17,6 +17,11 @@ public partial class ChatFunctionChoice private const string AutoValue = "auto"; private const string NoneValue = "none"; + // CUSTOM: Made internal. + internal ChatFunctionChoice() + { + } + // CUSTOM: Added custom internal constructor to handle the plain string representation (e.g. "auto", "none", etc.). internal ChatFunctionChoice(string predefinedFunctionChoice) { diff --git a/src/Custom/Chat/ChatMessageContentPart.cs b/src/Custom/Chat/ChatMessageContentPart.cs index bd16b113d..901c80d25 100644 --- a/src/Custom/Chat/ChatMessageContentPart.cs +++ b/src/Custom/Chat/ChatMessageContentPart.cs @@ -23,6 +23,12 @@ internal ChatMessageContentPart(string text) _kind = ChatMessageContentPartKind.Text; } + // CUSTOM: Made internal. + internal ChatMessageContentPart() + { + } + + internal ChatMessageContentPart(Uri imageUri, ImageChatMessageContentPartDetail? imageDetail = null) { Argument.AssertNotNull(imageUri, nameof(imageUri)); diff --git a/src/Custom/Chat/ChatResponseFormat.cs b/src/Custom/Chat/ChatResponseFormat.cs index 7d4954392..96ec8b837 100644 --- a/src/Custom/Chat/ChatResponseFormat.cs +++ b/src/Custom/Chat/ChatResponseFormat.cs @@ -25,7 +25,7 @@ public partial class ChatResponseFormat /// Must be one of `text` or `json_object`. [CodeGenMember("Type")] - internal InternalChatResponseFormatType? Type { get; set; } + internal InternalCreateChatCompletionRequestResponseFormatType? Type { get; set; } // CUSTOM: Made internal. /// Initializes a new instance of . @@ -33,13 +33,13 @@ internal ChatResponseFormat() { } - internal ChatResponseFormat(InternalChatResponseFormatType? type) + internal ChatResponseFormat(InternalCreateChatCompletionRequestResponseFormatType? type) { Type = type; } /// text. - public static ChatResponseFormat Text { get; } = new ChatResponseFormat(InternalChatResponseFormatType.Text); + public static ChatResponseFormat Text { get; } = new ChatResponseFormat(InternalCreateChatCompletionRequestResponseFormatType.Text); /// json_object. - public static ChatResponseFormat JsonObject { get; } = new ChatResponseFormat(InternalChatResponseFormatType.JsonObject); + public static ChatResponseFormat JsonObject { get; } = new ChatResponseFormat(InternalCreateChatCompletionRequestResponseFormatType.JsonObject); } \ No newline at end of file diff --git a/src/Custom/Chat/ChatToolChoice.cs b/src/Custom/Chat/ChatToolChoice.cs index b1e1617e8..4bf4e96fd 100644 --- a/src/Custom/Chat/ChatToolChoice.cs +++ b/src/Custom/Chat/ChatToolChoice.cs @@ -20,6 +20,11 @@ public partial class ChatToolChoice private const string NoneValue = "none"; private const string RequiredValue = "required"; + // CUSTOM: Made internal. + internal ChatToolChoice() + { + } + // CUSTOM: Added custom internal constructor to handle the plain string representation (e.g. "auto", "none", etc.). internal ChatToolChoice(string predefinedToolChoice) { diff --git a/src/Custom/Chat/ImageChatMessageContentPartDetail.cs b/src/Custom/Chat/ImageChatMessageContentPartDetail.cs index 9764ee5a2..b8702fd4a 100644 --- a/src/Custom/Chat/ImageChatMessageContentPartDetail.cs +++ b/src/Custom/Chat/ImageChatMessageContentPartDetail.cs @@ -1,6 +1,6 @@ namespace OpenAI.Chat; -[CodeGenModel("InternalChatCompletionRequestMessageContentPartImageImageUrlDetail")] +[CodeGenModel("ChatCompletionRequestMessageContentPartImageImageUrlDetail")] public readonly partial struct ImageChatMessageContentPartDetail { } diff --git a/src/Custom/Chat/Internal/GeneratorStubs.cs b/src/Custom/Chat/Internal/GeneratorStubs.cs index e2206cf4e..9aecc2712 100644 --- a/src/Custom/Chat/Internal/GeneratorStubs.cs +++ b/src/Custom/Chat/Internal/GeneratorStubs.cs @@ -42,22 +42,16 @@ internal readonly partial struct InternalChatCompletionResponseMessageRole { } [CodeGenModel("ChatCompletionStreamOptions")] internal partial class InternalChatCompletionStreamOptions { } -[CodeGenModel("InternalChatCompletionStreamResponseDeltaFunctionCall")] -internal partial class ChatCompletionStreamResponseDeltaFunctionCall { } - -[CodeGenModel("InternalChatCompletionStreamResponseDeltaRole")] +[CodeGenModel("ChatCompletionStreamResponseDeltaRole")] internal readonly partial struct InternalChatCompletionStreamResponseDeltaRole { } -[CodeGenModel("ChatResponseFormatType")] -internal readonly partial struct InternalChatResponseFormatType { } - [CodeGenModel("CreateChatCompletionFunctionResponse")] internal partial class InternalCreateChatCompletionFunctionResponse { } [CodeGenModel("CreateChatCompletionFunctionResponseChoice")] internal partial class InternalCreateChatCompletionFunctionResponseChoice { } -[CodeGenModel("InternalCreateChatCompletionFunctionResponseChoiceFinishReason")] +[CodeGenModel("CreateChatCompletionFunctionResponseChoiceFinishReason")] internal readonly partial struct InternalCreateChatCompletionFunctionResponseChoiceFinishReason { } [CodeGenModel("CreateChatCompletionFunctionResponseObject")] @@ -66,6 +60,12 @@ internal readonly partial struct InternalCreateChatCompletionFunctionResponseObj [CodeGenModel("CreateChatCompletionRequestModel")] internal readonly partial struct InternalCreateChatCompletionRequestModel { } +[CodeGenModel("CreateChatCompletionRequestResponseFormatType")] +internal readonly partial struct InternalCreateChatCompletionRequestResponseFormatType { } + +[CodeGenModel("CreateChatCompletionRequestToolChoice")] +internal readonly partial struct InternalCreateChatCompletionRequestToolChoice { } + [CodeGenModel("CreateChatCompletionResponseChoice")] internal partial class InternalCreateChatCompletionResponseChoice { } @@ -78,7 +78,7 @@ internal readonly partial struct InternalCreateChatCompletionResponseObject { } [CodeGenModel("CreateChatCompletionStreamResponseChoice")] internal partial class InternalCreateChatCompletionStreamResponseChoice { } -[CodeGenModel("InternalCreateChatCompletionStreamResponseChoiceFinishReason")] +[CodeGenModel("CreateChatCompletionStreamResponseChoiceFinishReason")] internal readonly partial struct InternalCreateChatCompletionStreamResponseChoiceFinishReason { } [CodeGenModel("CreateChatCompletionStreamResponseChoiceLogprobs")] diff --git a/src/Custom/Embeddings/EmbeddingClient.Protocol.cs b/src/Custom/Embeddings/EmbeddingClient.Protocol.cs index 3144560d4..1be366fde 100644 --- a/src/Custom/Embeddings/EmbeddingClient.Protocol.cs +++ b/src/Custom/Embeddings/EmbeddingClient.Protocol.cs @@ -1,7 +1,6 @@ using System; using System.ClientModel; using System.ClientModel.Primitives; -using System.Collections.Generic; using System.ComponentModel; using System.Threading.Tasks; diff --git a/src/Custom/Embeddings/EmbeddingClient.cs b/src/Custom/Embeddings/EmbeddingClient.cs index 351b29e6e..2280c9b54 100644 --- a/src/Custom/Embeddings/EmbeddingClient.cs +++ b/src/Custom/Embeddings/EmbeddingClient.cs @@ -190,6 +190,6 @@ private void CreateEmbeddingGenerationOptions(BinaryData input, ref EmbeddingGen { options.Input = input; options.Model = _model; - options.EncodingFormat = InternalEmbeddingGenerationOptionsEncodingFormat.Base64; + options.EncodingFormat = InternalCreateEmbeddingRequestEncodingFormat.Base64; } } diff --git a/src/Custom/Embeddings/EmbeddingGenerationOptions.cs b/src/Custom/Embeddings/EmbeddingGenerationOptions.cs index 169d50851..0d3e807e6 100644 --- a/src/Custom/Embeddings/EmbeddingGenerationOptions.cs +++ b/src/Custom/Embeddings/EmbeddingGenerationOptions.cs @@ -79,7 +79,7 @@ public partial class EmbeddingGenerationOptions /// The format to return the embeddings in. Can be either `float` or /// [`base64`](https://pypi.org/project/pybase64/). /// - internal InternalEmbeddingGenerationOptionsEncodingFormat? EncodingFormat { get; set; } + internal InternalCreateEmbeddingRequestEncodingFormat? EncodingFormat { get; set; } // CUSTOM: Made public now that there are no required properties. /// Initializes a new instance of . diff --git a/src/Custom/Embeddings/Internal/GeneratorStubs.cs b/src/Custom/Embeddings/Internal/GeneratorStubs.cs index b5cace35e..cb14eff92 100644 --- a/src/Custom/Embeddings/Internal/GeneratorStubs.cs +++ b/src/Custom/Embeddings/Internal/GeneratorStubs.cs @@ -2,6 +2,9 @@ // CUSTOM: Made internal. +[CodeGenModel("CreateEmbeddingRequestEncodingFormat")] +internal readonly partial struct InternalCreateEmbeddingRequestEncodingFormat { } + [CodeGenModel("CreateEmbeddingRequestModel")] internal readonly partial struct InternalCreateEmbeddingRequestModel { } @@ -9,7 +12,4 @@ internal readonly partial struct InternalCreateEmbeddingRequestModel { } internal readonly partial struct InternalCreateEmbeddingResponseObject { } [CodeGenModel("EmbeddingObject")] -internal readonly partial struct InternalEmbeddingObject { } - -[CodeGenModel("EmbeddingGenerationOptionsEncodingFormat")] -internal readonly partial struct InternalEmbeddingGenerationOptionsEncodingFormat { } \ No newline at end of file +internal readonly partial struct InternalEmbeddingObject { } \ No newline at end of file diff --git a/src/Custom/Files/FileUploadPurpose.cs b/src/Custom/Files/FileUploadPurpose.cs index fc27a7656..38b85f3c6 100644 --- a/src/Custom/Files/FileUploadPurpose.cs +++ b/src/Custom/Files/FileUploadPurpose.cs @@ -1,6 +1,6 @@ namespace OpenAI.Files; -[CodeGenModel("InternalFileUploadOptionsPurpose")] +[CodeGenModel("CreateFileRequestPurpose")] public readonly partial struct FileUploadPurpose { } \ No newline at end of file diff --git a/src/Custom/Files/OpenAIFilePurpose.cs b/src/Custom/Files/OpenAIFilePurpose.cs index 31a601101..ac282f07c 100644 --- a/src/Custom/Files/OpenAIFilePurpose.cs +++ b/src/Custom/Files/OpenAIFilePurpose.cs @@ -1,6 +1,6 @@ namespace OpenAI.Files; -[CodeGenModel("OpenAIFileInfoPurpose")] +[CodeGenModel("OpenAIFilePurpose")] public readonly partial struct OpenAIFilePurpose { } \ No newline at end of file diff --git a/src/Custom/Files/OpenAIFileStatus.cs b/src/Custom/Files/OpenAIFileStatus.cs index c791c1ea9..841f9904e 100644 --- a/src/Custom/Files/OpenAIFileStatus.cs +++ b/src/Custom/Files/OpenAIFileStatus.cs @@ -1,6 +1,6 @@ namespace OpenAI.Files; -[CodeGenModel("OpenAIFileInfoStatus")] +[CodeGenModel("OpenAIFileStatus")] public readonly partial struct OpenAIFileStatus { } \ No newline at end of file diff --git a/src/Custom/FineTuning/Internal/GeneratorStubs.cs b/src/Custom/FineTuning/Internal/GeneratorStubs.cs index 56c6f1eca..f55fd195a 100644 --- a/src/Custom/FineTuning/Internal/GeneratorStubs.cs +++ b/src/Custom/FineTuning/Internal/GeneratorStubs.cs @@ -20,6 +20,15 @@ internal partial class InternalCreateFineTuningJobRequestIntegrationWandb { } [CodeGenModel("CreateFineTuningJobRequestModel")] internal readonly partial struct InternalCreateFineTuningJobRequestModel { } +[CodeGenModel("FineTuneChatCompletionRequestAssistantMessage")] +internal partial class InternalFineTuneChatCompletionRequestAssistantMessage { } + +[CodeGenModel("FinetuneChatRequestInput")] +internal partial class InternalFinetuneChatRequestInput { } + +[CodeGenModel("FinetuneCompletionRequestInput")] +internal partial class InternalFinetuneCompletionRequestInput { } + [CodeGenModel("FineTuningIntegration")] internal partial class InternalFineTuningIntegration { } @@ -47,7 +56,7 @@ internal partial class InternalFineTuningJobError { } [CodeGenModel("FineTuningJobEvent")] internal partial class InternalFineTuningJobEvent { } -[CodeGenModel("InternalFineTuningJobEventLevel")] +[CodeGenModel("FineTuningJobEventLevel")] internal readonly partial struct InternalFineTuningJobEventLevel { } [CodeGenModel("FineTuningJobEventObject")] @@ -59,7 +68,7 @@ internal partial class InternalFineTuningJobHyperparameters { } [CodeGenModel("FineTuningJobObject")] internal readonly partial struct InternalFineTuningJobObject { } -[CodeGenModel("InternalFineTuningJobStatus")] +[CodeGenModel("FineTuningJobStatus")] internal readonly partial struct InternalFineTuningJobStatus { } [CodeGenModel("ListFineTuningJobCheckpointsResponse")] @@ -78,13 +87,4 @@ internal readonly partial struct InternalListFineTuningJobEventsResponseObject { internal partial class InternalListPaginatedFineTuningJobsResponse { } [CodeGenModel("ListPaginatedFineTuningJobsResponseObject")] -internal readonly partial struct InternalListPaginatedFineTuningJobsResponseObject { } - -[CodeGenModel("FinetuneCompletionRequestInput")] -internal partial class InternalFinetuneCompletionRequestInput { } - -[CodeGenModel("FinetuneChatRequestInput")] -internal partial class InternalFinetuneChatRequestInput { } - -[CodeGenModel("FineTuneChatCompletionRequestAssistantMessage")] -internal partial class InternalFineTuneChatCompletionRequestAssistantMessage { } \ No newline at end of file +internal readonly partial struct InternalListPaginatedFineTuningJobsResponseObject { } \ No newline at end of file diff --git a/src/Custom/Images/GeneratedImageFormat.cs b/src/Custom/Images/GeneratedImageFormat.cs index 78b5b5b75..93bdca9ec 100644 --- a/src/Custom/Images/GeneratedImageFormat.cs +++ b/src/Custom/Images/GeneratedImageFormat.cs @@ -18,7 +18,7 @@ namespace OpenAI.Images; /// /// /// -[CodeGenModel("ImageGenerationOptionsResponseFormat")] +[CodeGenModel("CreateImageRequestResponseFormat")] public enum GeneratedImageFormat { /// diff --git a/src/Custom/Images/GeneratedImageQuality.cs b/src/Custom/Images/GeneratedImageQuality.cs index 4697fdd30..6f25f99e8 100644 --- a/src/Custom/Images/GeneratedImageQuality.cs +++ b/src/Custom/Images/GeneratedImageQuality.cs @@ -15,7 +15,7 @@ namespace OpenAI.Images; /// - hd - Better consistency and finer details, but may be slower. /// /// -[CodeGenModel("ImageGenerationOptionsQuality")] +[CodeGenModel("CreateImageRequestQuality")] public enum GeneratedImageQuality { /// diff --git a/src/Custom/Images/GeneratedImageSize.cs b/src/Custom/Images/GeneratedImageSize.cs index 49800962f..49acb361b 100644 --- a/src/Custom/Images/GeneratedImageSize.cs +++ b/src/Custom/Images/GeneratedImageSize.cs @@ -6,7 +6,7 @@ namespace OpenAI.Images; /// /// Represents the available output dimensions for generated images. /// -[CodeGenModel("ImageGenerationOptionsSize")] +[CodeGenModel("CreateImageRequestSize")] [CodeGenSuppress("GeneratedImageSize", typeof(string))] [CodeGenSuppress("op_Implicit", typeof(string))] public readonly partial struct GeneratedImageSize : IEquatable diff --git a/src/Custom/Images/GeneratedImageStyle.cs b/src/Custom/Images/GeneratedImageStyle.cs index 819e2d87d..1ea6c49d5 100644 --- a/src/Custom/Images/GeneratedImageStyle.cs +++ b/src/Custom/Images/GeneratedImageStyle.cs @@ -9,7 +9,7 @@ namespace OpenAI.Images; /// generating hyper-real and dramatic images. Natural causes the model to produce more natural, less hyper-real /// looking images. This param is only supported for dall-e-3. /// -[CodeGenModel("ImageGenerationOptionsStyle")] +[CodeGenModel("CreateImageRequestStyle")] public enum GeneratedImageStyle { /// diff --git a/src/Custom/Images/ImageEditOptions.cs b/src/Custom/Images/ImageEditOptions.cs index 3d62ae9a7..c53bd522d 100644 --- a/src/Custom/Images/ImageEditOptions.cs +++ b/src/Custom/Images/ImageEditOptions.cs @@ -1,7 +1,4 @@ -using OpenAI.Embeddings; -using OpenAI.Internal; -using System; -using System.ClientModel.Primitives; +using System; using System.IO; namespace OpenAI.Images; diff --git a/src/Custom/Images/Internal/GeneratorStubs.cs b/src/Custom/Images/Internal/GeneratorStubs.cs index cac3828dd..24730c93e 100644 --- a/src/Custom/Images/Internal/GeneratorStubs.cs +++ b/src/Custom/Images/Internal/GeneratorStubs.cs @@ -5,20 +5,20 @@ [CodeGenModel("CreateImageEditRequestModel")] internal readonly partial struct InternalCreateImageEditRequestModel { } +[CodeGenModel("CreateImageEditRequestResponseFormat")] +internal readonly partial struct InternalCreateImageEditRequestResponseFormat { } + +[CodeGenModel("CreateImageEditRequestSize")] +internal readonly partial struct InternalCreateImageEditRequestSize { } + [CodeGenModel("CreateImageRequestModel")] internal readonly partial struct InternalCreateImageRequestModel { } [CodeGenModel("CreateImageVariationRequestModel")] internal readonly partial struct InternalCreateImageVariationRequestModel { } -[CodeGenModel("ImageEditOptionsResponseFormat")] -internal readonly partial struct InternalImageEditOptionsResponseFormat { } - -[CodeGenModel("ImageEditOptionsSize")] -internal readonly partial struct InternalImageEditOptionsSize { } - -[CodeGenModel("ImageVariationOptionsResponseFormat")] -internal readonly partial struct InternalImageVariationOptionsResponseFormat { } +[CodeGenModel("CreateImageVariationRequestResponseFormat")] +internal readonly partial struct InternalCreateImageVariationRequestResponseFormat { } -[CodeGenModel("ImageVariationOptionsSize")] -internal readonly partial struct InternalImageVariationOptionsSize { } +[CodeGenModel("CreateImageVariationRequestSize")] +internal readonly partial struct InternalCreateImageVariationRequestSize { } diff --git a/src/Custom/LegacyCompletions/Internal/GeneratorStubs.cs b/src/Custom/LegacyCompletions/Internal/GeneratorStubs.cs index 12f623868..a788ca91c 100644 --- a/src/Custom/LegacyCompletions/Internal/GeneratorStubs.cs +++ b/src/Custom/LegacyCompletions/Internal/GeneratorStubs.cs @@ -14,7 +14,7 @@ internal partial class InternalCreateCompletionResponse { } [CodeGenModel("CreateCompletionResponseChoice")] internal partial class InternalCreateCompletionResponseChoice { } -[CodeGenModel("InternalCreateCompletionResponseChoiceFinishReason")] +[CodeGenModel("CreateCompletionResponseChoiceFinishReason")] internal readonly partial struct InternalCreateCompletionResponseChoiceFinishReason { } [CodeGenModel("CreateCompletionResponseChoiceLogprobs")] diff --git a/src/Custom/OpenAIClient.cs b/src/Custom/OpenAIClient.cs index 91a044de5..dcf3b9443 100644 --- a/src/Custom/OpenAIClient.cs +++ b/src/Custom/OpenAIClient.cs @@ -1,299 +1,299 @@ -using OpenAI.Assistants; -using OpenAI.Audio; -using OpenAI.Batch; -using OpenAI.Chat; -using OpenAI.Embeddings; -using OpenAI.Files; -using OpenAI.FineTuning; -using OpenAI.Images; -using OpenAI.Models; -using OpenAI.Moderations; -using OpenAI.VectorStores; -using System; -using System.ClientModel; -using System.ClientModel.Primitives; -using System.Diagnostics.CodeAnalysis; - -namespace OpenAI; - -/// -/// A top-level client factory that enables convenient creation of scenario-specific sub-clients while reusing shared -/// configuration details like endpoint, authentication, and pipeline customization. -/// -[CodeGenModel("OpenAIClient")] -[CodeGenSuppress("OpenAIClient", typeof(ApiKeyCredential))] -[CodeGenSuppress("OpenAIClient", typeof(Uri), typeof(ApiKeyCredential), typeof(OpenAIClientOptions))] -[CodeGenSuppress("GetAssistantClientClient")] -[CodeGenSuppress("GetAudioClientClient")] -[CodeGenSuppress("GetBatchClientClient")] -[CodeGenSuppress("GetChatClientClient")] -[CodeGenSuppress("GetEmbeddingClientClient")] -[CodeGenSuppress("GetFileClientClient")] -[CodeGenSuppress("GetFineTuningClientClient")] -[CodeGenSuppress("GetImageClientClient")] -[CodeGenSuppress("GetInternalAssistantMessageClientClient")] -[CodeGenSuppress("GetInternalAssistantRunClientClient")] -[CodeGenSuppress("GetInternalAssistantThreadClientClient")] -[CodeGenSuppress("GetLegacyCompletionClientClient")] -[CodeGenSuppress("GetModelClientClient")] -[CodeGenSuppress("GetModerationClientClient")] -[CodeGenSuppress("GetVectorStoreClientClient")] -public partial class OpenAIClient -{ - private readonly OpenAIClientOptions _options; - - /// - /// The configured connection endpoint. - /// - protected Uri Endpoint => _endpoint; - - /// - /// Creates a new instance of . This type is used to share common - /// and client configuration details across scenario client instances created via - /// methods like . - /// - /// The API key to use when authenticating the client. - /// A common client options definition that all clients created by this should use. - /// The provided is null. - public OpenAIClient(ApiKeyCredential credential, OpenAIClientOptions options = null) - : this(CreatePipeline(GetApiKey(credential, requireExplicitCredential: true), options), GetEndpoint(options), options) - { - _keyCredential = credential; - } - - /// - /// Creates a new instance of . This type is used to share common - /// and client configuration details across scenario client instances created via - /// methods like . - /// - /// This constructor overload will use the value of the OPENAI_API_KEY environment variable as its - /// authentication mechanism. To provide an explicit credential, use an alternate constructor like - /// . - /// - /// - /// A common client options definition that all clients created by this should use. - public OpenAIClient(OpenAIClientOptions options = default) - : this(CreatePipeline(GetApiKey(), options), GetEndpoint(options), options) - {} - - /// - /// Creates a new instance of . - /// - /// The common client pipeline that should be used for all created scenario clients. - /// The HTTP endpoint to use. - /// The common client options that should be used for all created scenario clients. - protected OpenAIClient(ClientPipeline pipeline, Uri endpoint, OpenAIClientOptions options) - { - _pipeline = pipeline; - _endpoint = endpoint; - _options = options; - } - - /// - /// Gets a new instance of that reuses the client configuration details provided to - /// the instance. - /// - /// - /// This method is functionally equivalent to using the constructor directly with - /// the same configuration details. - /// - /// A new . - [Experimental("OPENAI001")] - public virtual AssistantClient GetAssistantClient() => new(_pipeline, _endpoint, _options); - - /// - /// Gets a new instance of that reuses the client configuration details provided to - /// the instance. - /// - /// - /// This method is functionally equivalent to using the constructor directly with - /// the same configuration details. - /// - /// A new . - public virtual AudioClient GetAudioClient(string model) => new(_pipeline, model, _endpoint, _options); - - /// - /// Gets a new instance of that reuses the client configuration details provided to - /// the instance. - /// - /// - /// This method is functionally equivalent to using the constructor directly with - /// the same configuration details. - /// - /// A new . - public virtual BatchClient GetBatchClient() => new(_pipeline, _endpoint, _options); - - /// - /// Gets a new instance of that reuses the client configuration details provided to - /// the instance. - /// - /// - /// This method is functionally equivalent to using the constructor directly with - /// the same configuration details. - /// - /// A new . - public virtual ChatClient GetChatClient(string model) => new(_pipeline, model, _endpoint, _options); - - /// - /// Gets a new instance of that reuses the client configuration details provided to - /// the instance. - /// - /// - /// This method is functionally equivalent to using the constructor directly with - /// the same configuration details. - /// - /// A new . - public virtual EmbeddingClient GetEmbeddingClient(string model) => new(_pipeline, model, _endpoint, _options); - - /// - /// Gets a new instance of that reuses the client configuration details provided to - /// the instance. - /// - /// - /// This method is functionally equivalent to using the constructor directly with - /// the same configuration details. - /// - /// A new . - public virtual FileClient GetFileClient() => new(_pipeline, _endpoint, _options); - - /// - /// Gets a new instance of that reuses the client configuration details provided to - /// the instance. - /// - /// - /// This method is functionally equivalent to using the constructor directly with - /// the same configuration details. - /// - /// A new . - public virtual FineTuningClient GetFineTuningClient() => new(_pipeline, _endpoint, _options); - - /// - /// Gets a new instance of that reuses the client configuration details provided to - /// the instance. - /// - /// - /// This method is functionally equivalent to using the constructor directly with - /// the same configuration details. - /// - /// A new . - public virtual ImageClient GetImageClient(string model) => new(_pipeline, model, _endpoint, _options); - - /// - /// Gets a new instance of that reuses the client configuration details provided to - /// the instance. - /// - /// - /// This method is functionally equivalent to using the constructor directly with - /// the same configuration details. - /// - /// A new . - public virtual ModelClient GetModelClient() => new(_pipeline, _endpoint, _options); - - /// - /// Gets a new instance of that reuses the client configuration details provided to - /// the instance. - /// - /// - /// This method is functionally equivalent to using the constructor directly with - /// the same configuration details. - /// - /// A new . - public virtual ModerationClient GetModerationClient(string model) => new(_pipeline, model, _endpoint, _options); - - /// - /// Gets a new instance of that reuses the client configuration details provided to - /// the instance. - /// - /// - /// This method is functionally equivalent to using the constructor directly with - /// the same configuration details. - /// - /// A new . - [Experimental("OPENAI001")] - public virtual VectorStoreClient GetVectorStoreClient() => new(_pipeline, _endpoint, _options); - - internal static ClientPipeline CreatePipeline(ApiKeyCredential credential, OpenAIClientOptions options = null) - { - return ClientPipeline.Create( - options ?? new(), - perCallPolicies: [ +using OpenAI.Assistants; +using OpenAI.Audio; +using OpenAI.Batch; +using OpenAI.Chat; +using OpenAI.Embeddings; +using OpenAI.Files; +using OpenAI.FineTuning; +using OpenAI.Images; +using OpenAI.Models; +using OpenAI.Moderations; +using OpenAI.VectorStores; +using System; +using System.ClientModel; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; + +namespace OpenAI; + +/// +/// A top-level client factory that enables convenient creation of scenario-specific sub-clients while reusing shared +/// configuration details like endpoint, authentication, and pipeline customization. +/// +[CodeGenModel("OpenAIClient")] +[CodeGenSuppress("OpenAIClient", typeof(ApiKeyCredential))] +[CodeGenSuppress("OpenAIClient", typeof(Uri), typeof(ApiKeyCredential), typeof(OpenAIClientOptions))] +[CodeGenSuppress("GetAssistantClientClient")] +[CodeGenSuppress("GetAudioClientClient")] +[CodeGenSuppress("GetBatchClientClient")] +[CodeGenSuppress("GetChatClientClient")] +[CodeGenSuppress("GetEmbeddingClientClient")] +[CodeGenSuppress("GetFileClientClient")] +[CodeGenSuppress("GetFineTuningClientClient")] +[CodeGenSuppress("GetImageClientClient")] +[CodeGenSuppress("GetInternalAssistantMessageClientClient")] +[CodeGenSuppress("GetInternalAssistantRunClientClient")] +[CodeGenSuppress("GetInternalAssistantThreadClientClient")] +[CodeGenSuppress("GetLegacyCompletionClientClient")] +[CodeGenSuppress("GetModelClientClient")] +[CodeGenSuppress("GetModerationClientClient")] +[CodeGenSuppress("GetVectorStoreClientClient")] +public partial class OpenAIClient +{ + private readonly OpenAIClientOptions _options; + + /// + /// The configured connection endpoint. + /// + protected Uri Endpoint => _endpoint; + + /// + /// Creates a new instance of . This type is used to share common + /// and client configuration details across scenario client instances created via + /// methods like . + /// + /// The API key to use when authenticating the client. + /// A common client options definition that all clients created by this should use. + /// The provided is null. + public OpenAIClient(ApiKeyCredential credential, OpenAIClientOptions options = null) + : this(CreatePipeline(GetApiKey(credential, requireExplicitCredential: true), options), GetEndpoint(options), options) + { + _keyCredential = credential; + } + + /// + /// Creates a new instance of . This type is used to share common + /// and client configuration details across scenario client instances created via + /// methods like . + /// + /// This constructor overload will use the value of the OPENAI_API_KEY environment variable as its + /// authentication mechanism. To provide an explicit credential, use an alternate constructor like + /// . + /// + /// + /// A common client options definition that all clients created by this should use. + public OpenAIClient(OpenAIClientOptions options = default) + : this(CreatePipeline(GetApiKey(), options), GetEndpoint(options), options) + {} + + /// + /// Creates a new instance of . + /// + /// The common client pipeline that should be used for all created scenario clients. + /// The HTTP endpoint to use. + /// The common client options that should be used for all created scenario clients. + protected OpenAIClient(ClientPipeline pipeline, Uri endpoint, OpenAIClientOptions options) + { + _pipeline = pipeline; + _endpoint = endpoint; + _options = options; + } + + /// + /// Gets a new instance of that reuses the client configuration details provided to + /// the instance. + /// + /// + /// This method is functionally equivalent to using the constructor directly with + /// the same configuration details. + /// + /// A new . + [Experimental("OPENAI001")] + public virtual AssistantClient GetAssistantClient() => new(_pipeline, _endpoint, _options); + + /// + /// Gets a new instance of that reuses the client configuration details provided to + /// the instance. + /// + /// + /// This method is functionally equivalent to using the constructor directly with + /// the same configuration details. + /// + /// A new . + public virtual AudioClient GetAudioClient(string model) => new(_pipeline, model, _endpoint, _options); + + /// + /// Gets a new instance of that reuses the client configuration details provided to + /// the instance. + /// + /// + /// This method is functionally equivalent to using the constructor directly with + /// the same configuration details. + /// + /// A new . + public virtual BatchClient GetBatchClient() => new(_pipeline, _endpoint, _options); + + /// + /// Gets a new instance of that reuses the client configuration details provided to + /// the instance. + /// + /// + /// This method is functionally equivalent to using the constructor directly with + /// the same configuration details. + /// + /// A new . + public virtual ChatClient GetChatClient(string model) => new(_pipeline, model, _endpoint, _options); + + /// + /// Gets a new instance of that reuses the client configuration details provided to + /// the instance. + /// + /// + /// This method is functionally equivalent to using the constructor directly with + /// the same configuration details. + /// + /// A new . + public virtual EmbeddingClient GetEmbeddingClient(string model) => new(_pipeline, model, _endpoint, _options); + + /// + /// Gets a new instance of that reuses the client configuration details provided to + /// the instance. + /// + /// + /// This method is functionally equivalent to using the constructor directly with + /// the same configuration details. + /// + /// A new . + public virtual FileClient GetFileClient() => new(_pipeline, _endpoint, _options); + + /// + /// Gets a new instance of that reuses the client configuration details provided to + /// the instance. + /// + /// + /// This method is functionally equivalent to using the constructor directly with + /// the same configuration details. + /// + /// A new . + public virtual FineTuningClient GetFineTuningClient() => new(_pipeline, _endpoint, _options); + + /// + /// Gets a new instance of that reuses the client configuration details provided to + /// the instance. + /// + /// + /// This method is functionally equivalent to using the constructor directly with + /// the same configuration details. + /// + /// A new . + public virtual ImageClient GetImageClient(string model) => new(_pipeline, model, _endpoint, _options); + + /// + /// Gets a new instance of that reuses the client configuration details provided to + /// the instance. + /// + /// + /// This method is functionally equivalent to using the constructor directly with + /// the same configuration details. + /// + /// A new . + public virtual ModelClient GetModelClient() => new(_pipeline, _endpoint, _options); + + /// + /// Gets a new instance of that reuses the client configuration details provided to + /// the instance. + /// + /// + /// This method is functionally equivalent to using the constructor directly with + /// the same configuration details. + /// + /// A new . + public virtual ModerationClient GetModerationClient(string model) => new(_pipeline, model, _endpoint, _options); + + /// + /// Gets a new instance of that reuses the client configuration details provided to + /// the instance. + /// + /// + /// This method is functionally equivalent to using the constructor directly with + /// the same configuration details. + /// + /// A new . + [Experimental("OPENAI001")] + public virtual VectorStoreClient GetVectorStoreClient() => new(_pipeline, _endpoint, _options); + + internal static ClientPipeline CreatePipeline(ApiKeyCredential credential, OpenAIClientOptions options = null) + { + return ClientPipeline.Create( + options ?? new(), + perCallPolicies: [ CreateAddBetaFeatureHeaderPolicy(), - CreateAddCustomHeadersPolicy(options), - ], - perTryPolicies: - [ - ApiKeyAuthenticationPolicy.CreateHeaderApiKeyPolicy(credential, AuthorizationHeader, AuthorizationApiKeyPrefix) - ], - beforeTransportPolicies: []); - } - - internal static Uri GetEndpoint(OpenAIClientOptions options) - { - return options?.Endpoint ?? new(Environment.GetEnvironmentVariable(OpenAIEndpointEnvironmentVariable) ?? OpenAIV1Endpoint); - } - - internal static ApiKeyCredential GetApiKey(ApiKeyCredential explicitCredential = null, bool requireExplicitCredential = false) - { - if (explicitCredential is not null) - { - return explicitCredential; - } - else if (requireExplicitCredential) - { - throw new ArgumentNullException(nameof(explicitCredential), $"A non-null credential value is required."); - } - else - { - string environmentApiKey = Environment.GetEnvironmentVariable(OpenAIApiKeyEnvironmentVariable); - if (string.IsNullOrEmpty(environmentApiKey)) - { - throw new InvalidOperationException( - $"No environment variable value was found for {OpenAIApiKeyEnvironmentVariable}. " - + "Please either populate this environment variable or provide authentication information directly " - + "to the client constructor."); - } - return new(environmentApiKey); - } - } - - private static PipelinePolicy CreateAddBetaFeatureHeaderPolicy() - { - return new GenericActionPipelinePolicy((message) => - { - if (message?.Request?.Headers?.TryGetValue(OpenAIBetaFeatureHeaderName, out string _) == false) - { - message.Request.Headers.Set(OpenAIBetaFeatureHeaderName, OpenAIBetaAssistantsV1HeaderValue); - } - }); - } - - private static PipelinePolicy CreateAddCustomHeadersPolicy(OpenAIClientOptions options = null) - { - TelemetryDetails telemetryDetails = new(typeof(OpenAIClientOptions).Assembly, options?.ApplicationId); - return new GenericActionPipelinePolicy((message) => - { - if (message?.Request?.Headers?.TryGetValue(UserAgentHeaderName, out string _) == false) - { - message.Request.Headers.Set(UserAgentHeaderName, telemetryDetails.ToString()); - } - + CreateAddCustomHeadersPolicy(options), + ], + perTryPolicies: + [ + ApiKeyAuthenticationPolicy.CreateHeaderApiKeyPolicy(credential, AuthorizationHeader, AuthorizationApiKeyPrefix) + ], + beforeTransportPolicies: []); + } + + internal static Uri GetEndpoint(OpenAIClientOptions options) + { + return options?.Endpoint ?? new(Environment.GetEnvironmentVariable(OpenAIEndpointEnvironmentVariable) ?? OpenAIV1Endpoint); + } + + internal static ApiKeyCredential GetApiKey(ApiKeyCredential explicitCredential = null, bool requireExplicitCredential = false) + { + if (explicitCredential is not null) + { + return explicitCredential; + } + else if (requireExplicitCredential) + { + throw new ArgumentNullException(nameof(explicitCredential), $"A non-null credential value is required."); + } + else + { + string environmentApiKey = Environment.GetEnvironmentVariable(OpenAIApiKeyEnvironmentVariable); + if (string.IsNullOrEmpty(environmentApiKey)) + { + throw new InvalidOperationException( + $"No environment variable value was found for {OpenAIApiKeyEnvironmentVariable}. " + + "Please either populate this environment variable or provide authentication information directly " + + "to the client constructor."); + } + return new(environmentApiKey); + } + } + + private static PipelinePolicy CreateAddBetaFeatureHeaderPolicy() + { + return new GenericActionPipelinePolicy((message) => + { + if (message?.Request?.Headers?.TryGetValue(OpenAIBetaFeatureHeaderName, out string _) == false) + { + message.Request.Headers.Set(OpenAIBetaFeatureHeaderName, OpenAIBetaAssistantsV1HeaderValue); + } + }); + } + + private static PipelinePolicy CreateAddCustomHeadersPolicy(OpenAIClientOptions options = null) + { + TelemetryDetails telemetryDetails = new(typeof(OpenAIClientOptions).Assembly, options?.ApplicationId); + return new GenericActionPipelinePolicy((message) => + { + if (message?.Request?.Headers?.TryGetValue(UserAgentHeaderName, out string _) == false) + { + message.Request.Headers.Set(UserAgentHeaderName, telemetryDetails.ToString()); + } + if (!string.IsNullOrEmpty(options?.OrganizationId)) { message.Request.Headers.Set(OpenAIOrganizationHeaderName, options.OrganizationId); } if (!string.IsNullOrEmpty(options?.ProjectId)) { - message.Request.Headers.Set(OpenAIProjectHeaderName, options.ProjectId); - } - }); - } - + message.Request.Headers.Set(OpenAIProjectHeaderName, options.ProjectId); + } + }); + } + private const string OpenAIBetaFeatureHeaderName = "OpenAI-Beta"; - private const string OpenAIOrganizationHeaderName = "OpenAI-Organization"; - private const string OpenAIProjectHeaderName = "OpenAI-Project"; - private const string OpenAIBetaAssistantsV1HeaderValue = "assistants=v2"; - private const string OpenAIEndpointEnvironmentVariable = "OPENAI_ENDPOINT"; - private const string OpenAIApiKeyEnvironmentVariable = "OPENAI_API_KEY"; - private const string OpenAIV1Endpoint = "https://api.openai.com/v1"; - private const string UserAgentHeaderName = "User-Agent"; -} + private const string OpenAIOrganizationHeaderName = "OpenAI-Organization"; + private const string OpenAIProjectHeaderName = "OpenAI-Project"; + private const string OpenAIBetaAssistantsV1HeaderValue = "assistants=v2"; + private const string OpenAIEndpointEnvironmentVariable = "OPENAI_ENDPOINT"; + private const string OpenAIApiKeyEnvironmentVariable = "OPENAI_API_KEY"; + private const string OpenAIV1Endpoint = "https://api.openai.com/v1"; + private const string UserAgentHeaderName = "User-Agent"; +} diff --git a/src/Custom/OpenAIClientOptions.cs b/src/Custom/OpenAIClientOptions.cs index 5835d0fd2..3a46b4796 100644 --- a/src/Custom/OpenAIClientOptions.cs +++ b/src/Custom/OpenAIClientOptions.cs @@ -1,31 +1,31 @@ -using System; -using System.ClientModel.Primitives; - -namespace OpenAI; - -/// -/// Client-level options for the OpenAI service. -/// -[CodeGenModel("OpenAIClientOptions")] -public partial class OpenAIClientOptions : ClientPipelineOptions -{ - /// - /// A non-default base endpoint that clients should use when connecting. - /// - public Uri Endpoint { get; init; } - - /// - /// An optional application ID to use as part of the request User-Agent header. - /// - public string ApplicationId { get; init; } - +using System; +using System.ClientModel.Primitives; + +namespace OpenAI; + +/// +/// Client-level options for the OpenAI service. +/// +[CodeGenModel("OpenAIClientOptions")] +public partial class OpenAIClientOptions : ClientPipelineOptions +{ + /// + /// A non-default base endpoint that clients should use when connecting. + /// + public Uri Endpoint { get; init; } + + /// + /// An optional application ID to use as part of the request User-Agent header. + /// + public string ApplicationId { get; init; } + /// /// An optional ID added to OpenAI-Organization header - /// - public string OrganizationId { get; init; } - + /// + public string OrganizationId { get; init; } + /// /// An optional ID added to OpenAI-Project header - /// - public string ProjectId { get; init; } -} + /// + public string ProjectId { get; init; } +} diff --git a/src/Custom/VectorStores/VectorStoreBatchFileJobStatus.cs b/src/Custom/VectorStores/VectorStoreBatchFileJobStatus.cs index 4894e9292..d65197875 100644 --- a/src/Custom/VectorStores/VectorStoreBatchFileJobStatus.cs +++ b/src/Custom/VectorStores/VectorStoreBatchFileJobStatus.cs @@ -1,6 +1,6 @@ namespace OpenAI.VectorStores; -[CodeGenModel("VectorStoreBatchFileJobStatus")] +[CodeGenModel("VectorStoreFileBatchObjectStatus")] public readonly partial struct VectorStoreBatchFileJobStatus { } \ No newline at end of file diff --git a/src/Custom/VectorStores/VectorStoreFileAssociationErrorCode.cs b/src/Custom/VectorStores/VectorStoreFileAssociationErrorCode.cs index 1d55daa87..fbf81648f 100644 --- a/src/Custom/VectorStores/VectorStoreFileAssociationErrorCode.cs +++ b/src/Custom/VectorStores/VectorStoreFileAssociationErrorCode.cs @@ -1,6 +1,6 @@ namespace OpenAI.VectorStores; -[CodeGenModel("VectorStoreFileAssociationErrorCode")] +[CodeGenModel("VectorStoreFileObjectLastErrorCode")] public readonly partial struct VectorStoreFileAssociationErrorCode { } \ No newline at end of file diff --git a/src/Custom/VectorStores/VectorStoreFileAssociationStatus.cs b/src/Custom/VectorStores/VectorStoreFileAssociationStatus.cs index e891d1dc1..8890f08e6 100644 --- a/src/Custom/VectorStores/VectorStoreFileAssociationStatus.cs +++ b/src/Custom/VectorStores/VectorStoreFileAssociationStatus.cs @@ -5,7 +5,7 @@ namespace OpenAI.VectorStores; /// /// Represents the possible states for a vector store file association. /// -[CodeGenModel("VectorStoreFileAssociationStatus")] +[CodeGenModel("VectorStoreFileObjectStatus")] public enum VectorStoreFileAssociationStatus { /// diff --git a/src/Custom/VectorStores/VectorStoreStatus.cs b/src/Custom/VectorStores/VectorStoreStatus.cs index e95c75a8f..e4c7e842c 100644 --- a/src/Custom/VectorStores/VectorStoreStatus.cs +++ b/src/Custom/VectorStores/VectorStoreStatus.cs @@ -5,7 +5,7 @@ namespace OpenAI.VectorStores; /// /// Represents the possible states for a vector store. /// -[CodeGenModel("VectorStoreStatus")] +[CodeGenModel("VectorStoreObjectStatus")] public enum VectorStoreStatus { /// diff --git a/src/Generated/Models/Assistant.Serialization.cs b/src/Generated/Models/Assistant.Serialization.cs index 2b1582491..36bfacaf3 100644 --- a/src/Generated/Models/Assistant.Serialization.cs +++ b/src/Generated/Models/Assistant.Serialization.cs @@ -114,6 +114,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions writer.WriteNull("top_p"); } } + // CUSTOM: Made nullable. if (Optional.IsDefined(ResponseFormat)) { if (ResponseFormat != null) @@ -286,6 +287,7 @@ internal static Assistant DeserializeAssistant(JsonElement element, ModelReaderW topP = property.Value.GetSingle(); continue; } + // CUSTOM: Made nullable. if (property.NameEquals("response_format"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) diff --git a/src/Generated/Models/AssistantCreationOptions.Serialization.cs b/src/Generated/Models/AssistantCreationOptions.Serialization.cs index bd3c9e3a7..f0ceb1e79 100644 --- a/src/Generated/Models/AssistantCreationOptions.Serialization.cs +++ b/src/Generated/Models/AssistantCreationOptions.Serialization.cs @@ -123,6 +123,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRead writer.WriteNull("top_p"); } } + // CUSTOM: Made nullable. if (Optional.IsDefined(ResponseFormat)) { if (ResponseFormat != null) @@ -280,6 +281,7 @@ internal static AssistantCreationOptions DeserializeAssistantCreationOptions(Jso topP = property.Value.GetSingle(); continue; } + // CUSTOM: Made nullable. if (property.NameEquals("response_format"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) diff --git a/src/Generated/Models/AssistantModificationOptions.Serialization.cs b/src/Generated/Models/AssistantModificationOptions.Serialization.cs index 84b66ead7..5adbed5b4 100644 --- a/src/Generated/Models/AssistantModificationOptions.Serialization.cs +++ b/src/Generated/Models/AssistantModificationOptions.Serialization.cs @@ -126,6 +126,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, Model writer.WriteNull("top_p"); } } + // CUSTOM: Made nullable. if (Optional.IsDefined(ResponseFormat)) { if (ResponseFormat != null) @@ -283,6 +284,7 @@ internal static AssistantModificationOptions DeserializeAssistantModificationOpt topP = property.Value.GetSingle(); continue; } + // CUSTOM: Made nullable. if (property.NameEquals("response_format"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) diff --git a/src/Generated/Models/AssistantToolsFileSearchTypeOnlyType.cs b/src/Generated/Models/AssistantToolsFileSearchTypeOnlyType.cs deleted file mode 100644 index 5993c76e1..000000000 --- a/src/Generated/Models/AssistantToolsFileSearchTypeOnlyType.cs +++ /dev/null @@ -1,34 +0,0 @@ -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace OpenAI.Internal.Models -{ - internal readonly partial struct AssistantToolsFileSearchTypeOnlyType : IEquatable - { - private readonly string _value; - - public AssistantToolsFileSearchTypeOnlyType(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string FileSearchValue = "file_search"; - - public static AssistantToolsFileSearchTypeOnlyType FileSearch { get; } = new AssistantToolsFileSearchTypeOnlyType(FileSearchValue); - public static bool operator ==(AssistantToolsFileSearchTypeOnlyType left, AssistantToolsFileSearchTypeOnlyType right) => left.Equals(right); - public static bool operator !=(AssistantToolsFileSearchTypeOnlyType left, AssistantToolsFileSearchTypeOnlyType right) => !left.Equals(right); - public static implicit operator AssistantToolsFileSearchTypeOnlyType(string value) => new AssistantToolsFileSearchTypeOnlyType(value); - - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is AssistantToolsFileSearchTypeOnlyType other && Equals(other); - public bool Equals(AssistantToolsFileSearchTypeOnlyType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; - public override string ToString() => _value; - } -} diff --git a/src/Generated/Models/AudioTranscription.Serialization.cs b/src/Generated/Models/AudioTranscription.Serialization.cs index 772adfd89..5f5363441 100644 --- a/src/Generated/Models/AudioTranscription.Serialization.cs +++ b/src/Generated/Models/AudioTranscription.Serialization.cs @@ -26,7 +26,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("language"u8); writer.WriteStringValue(Language); writer.WritePropertyName("duration"u8); - writer.WriteNumberValue(Convert.ToDouble(Duration.Value.ToString("s\\.fff"))); + writer.WriteNumberValue(Convert.ToDouble(Duration.Value.ToString("s\\.FFF"))); writer.WritePropertyName("text"u8); writer.WriteStringValue(Text); if (Optional.IsCollectionDefined(Words)) diff --git a/src/Generated/Models/AudioTranslation.Serialization.cs b/src/Generated/Models/AudioTranslation.Serialization.cs index 1e04f5a63..85212880e 100644 --- a/src/Generated/Models/AudioTranslation.Serialization.cs +++ b/src/Generated/Models/AudioTranslation.Serialization.cs @@ -26,7 +26,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriter writer.WritePropertyName("language"u8); writer.WriteStringValue(Language); writer.WritePropertyName("duration"u8); - writer.WriteNumberValue(Convert.ToDouble(Duration.Value.ToString("s\\.fff"))); + writer.WriteNumberValue(Convert.ToDouble(Duration.Value.ToString("s\\.FFF"))); writer.WritePropertyName("text"u8); writer.WriteStringValue(Text); if (Optional.IsCollectionDefined(Segments)) diff --git a/src/Generated/Models/ChatCompletionOptions.Serialization.cs b/src/Generated/Models/ChatCompletionOptions.Serialization.cs index 8d63136d2..1d619855d 100644 --- a/src/Generated/Models/ChatCompletionOptions.Serialization.cs +++ b/src/Generated/Models/ChatCompletionOptions.Serialization.cs @@ -47,7 +47,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderW if (LogitBiases != null) { writer.WritePropertyName("logit_bias"u8); - SerializeLogitBiasesValue(writer); + SerializeLogitBiasesValue(writer, options); } else { @@ -134,7 +134,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderW if (Optional.IsCollectionDefined(StopSequences)) { writer.WritePropertyName("stop"u8); - SerializeStopSequencesValue(writer); + SerializeStopSequencesValue(writer, options); } if (Optional.IsDefined(Stream)) { diff --git a/src/Generated/Models/ChatFunctionChoice.cs b/src/Generated/Models/ChatFunctionChoice.cs index 5add9f311..0121466a8 100644 --- a/src/Generated/Models/ChatFunctionChoice.cs +++ b/src/Generated/Models/ChatFunctionChoice.cs @@ -10,9 +10,5 @@ namespace OpenAI.Chat public partial class ChatFunctionChoice { internal IDictionary _serializedAdditionalRawData; - - internal ChatFunctionChoice() - { - } } } diff --git a/src/Generated/Models/ChatMessageContentPart.cs b/src/Generated/Models/ChatMessageContentPart.cs index e8fdce694..17d640bcd 100644 --- a/src/Generated/Models/ChatMessageContentPart.cs +++ b/src/Generated/Models/ChatMessageContentPart.cs @@ -10,9 +10,5 @@ namespace OpenAI.Chat public partial class ChatMessageContentPart { internal IDictionary _serializedAdditionalRawData; - - internal ChatMessageContentPart() - { - } } } diff --git a/src/Generated/Models/ChatResponseFormat.Serialization.cs b/src/Generated/Models/ChatResponseFormat.Serialization.cs index a521fe71c..21949133c 100644 --- a/src/Generated/Models/ChatResponseFormat.Serialization.cs +++ b/src/Generated/Models/ChatResponseFormat.Serialization.cs @@ -64,7 +64,7 @@ internal static ChatResponseFormat DeserializeChatResponseFormat(JsonElement ele { return null; } - InternalChatResponseFormatType? type = default; + InternalCreateChatCompletionRequestResponseFormatType? type = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -75,7 +75,7 @@ internal static ChatResponseFormat DeserializeChatResponseFormat(JsonElement ele { continue; } - type = new InternalChatResponseFormatType(property.Value.GetString()); + type = new InternalCreateChatCompletionRequestResponseFormatType(property.Value.GetString()); continue; } if (true) diff --git a/src/Generated/Models/ChatResponseFormat.cs b/src/Generated/Models/ChatResponseFormat.cs index abb20ed3a..c9b72ccdb 100644 --- a/src/Generated/Models/ChatResponseFormat.cs +++ b/src/Generated/Models/ChatResponseFormat.cs @@ -11,7 +11,7 @@ public partial class ChatResponseFormat { internal IDictionary _serializedAdditionalRawData; - internal ChatResponseFormat(InternalChatResponseFormatType? type, IDictionary serializedAdditionalRawData) + internal ChatResponseFormat(InternalCreateChatCompletionRequestResponseFormatType? type, IDictionary serializedAdditionalRawData) { Type = type; _serializedAdditionalRawData = serializedAdditionalRawData; diff --git a/src/Generated/Models/ChatToolChoice.cs b/src/Generated/Models/ChatToolChoice.cs index 2b62f6a04..96a88653b 100644 --- a/src/Generated/Models/ChatToolChoice.cs +++ b/src/Generated/Models/ChatToolChoice.cs @@ -10,9 +10,5 @@ namespace OpenAI.Chat public partial class ChatToolChoice { internal IDictionary _serializedAdditionalRawData; - - internal ChatToolChoice() - { - } } } diff --git a/src/Generated/Models/EmbeddingGenerationOptions.Serialization.cs b/src/Generated/Models/EmbeddingGenerationOptions.Serialization.cs index 9a7943bf0..37c75c0e7 100644 --- a/src/Generated/Models/EmbeddingGenerationOptions.Serialization.cs +++ b/src/Generated/Models/EmbeddingGenerationOptions.Serialization.cs @@ -87,7 +87,7 @@ internal static EmbeddingGenerationOptions DeserializeEmbeddingGenerationOptions } BinaryData input = default; InternalCreateEmbeddingRequestModel model = default; - InternalEmbeddingGenerationOptionsEncodingFormat? encodingFormat = default; + InternalCreateEmbeddingRequestEncodingFormat? encodingFormat = default; int? dimensions = default; string user = default; IDictionary serializedAdditionalRawData = default; @@ -110,7 +110,7 @@ internal static EmbeddingGenerationOptions DeserializeEmbeddingGenerationOptions { continue; } - encodingFormat = new InternalEmbeddingGenerationOptionsEncodingFormat(property.Value.GetString()); + encodingFormat = new InternalCreateEmbeddingRequestEncodingFormat(property.Value.GetString()); continue; } if (property.NameEquals("dimensions"u8)) diff --git a/src/Generated/Models/EmbeddingGenerationOptions.cs b/src/Generated/Models/EmbeddingGenerationOptions.cs index 30c601db6..0b2afe9a8 100644 --- a/src/Generated/Models/EmbeddingGenerationOptions.cs +++ b/src/Generated/Models/EmbeddingGenerationOptions.cs @@ -11,7 +11,7 @@ public partial class EmbeddingGenerationOptions { internal IDictionary _serializedAdditionalRawData; - internal EmbeddingGenerationOptions(BinaryData input, InternalCreateEmbeddingRequestModel model, InternalEmbeddingGenerationOptionsEncodingFormat? encodingFormat, int? dimensions, string user, IDictionary serializedAdditionalRawData) + internal EmbeddingGenerationOptions(BinaryData input, InternalCreateEmbeddingRequestModel model, InternalCreateEmbeddingRequestEncodingFormat? encodingFormat, int? dimensions, string user, IDictionary serializedAdditionalRawData) { Input = input; Model = model; diff --git a/src/Generated/Models/FileSearchToolResources.Serialization.cs b/src/Generated/Models/FileSearchToolResources.Serialization.cs index ca7c03c3d..ab1632384 100644 --- a/src/Generated/Models/FileSearchToolResources.Serialization.cs +++ b/src/Generated/Models/FileSearchToolResources.Serialization.cs @@ -34,7 +34,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReade if (true && Optional.IsCollectionDefined(NewVectorStores)) { writer.WritePropertyName("vector_stores"u8); - SerializeNewVectorStores(writer); + SerializeNewVectorStores(writer, options); } if (true && _serializedAdditionalRawData != null) { diff --git a/src/Generated/Models/ImageEditOptions.Serialization.cs b/src/Generated/Models/ImageEditOptions.Serialization.cs index bd8723e0a..e7bf6472b 100644 --- a/src/Generated/Models/ImageEditOptions.Serialization.cs +++ b/src/Generated/Models/ImageEditOptions.Serialization.cs @@ -71,13 +71,27 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriter } if (Optional.IsDefined(Size)) { - writer.WritePropertyName("size"u8); - writer.WriteStringValue(Size.Value.ToString()); + if (Size != null) + { + writer.WritePropertyName("size"u8); + writer.WriteStringValue(Size.Value.ToString()); + } + else + { + writer.WriteNull("size"); + } } if (Optional.IsDefined(ResponseFormat)) { - writer.WritePropertyName("response_format"u8); - writer.WriteStringValue(ResponseFormat.Value.ToSerialString()); + if (ResponseFormat != null) + { + writer.WritePropertyName("response_format"u8); + writer.WriteStringValue(ResponseFormat.Value.ToSerialString()); + } + else + { + writer.WriteNull("response_format"); + } } if (Optional.IsDefined(User)) { @@ -177,6 +191,7 @@ internal static ImageEditOptions DeserializeImageEditOptions(JsonElement element { if (property.Value.ValueKind == JsonValueKind.Null) { + size = null; continue; } size = new GeneratedImageSize(property.Value.GetString()); @@ -186,6 +201,7 @@ internal static ImageEditOptions DeserializeImageEditOptions(JsonElement element { if (property.Value.ValueKind == JsonValueKind.Null) { + responseFormat = null; continue; } responseFormat = property.Value.GetString().ToGeneratedImageFormat(); @@ -254,11 +270,17 @@ internal virtual MultipartFormDataBinaryContent ToMultipartBinaryBody() } if (Optional.IsDefined(Size)) { - content.Add(Size.Value.ToString(), "size"); + if (Size != null) + { + content.Add(Size.Value.ToString(), "size"); + } } if (Optional.IsDefined(ResponseFormat)) { - content.Add(ResponseFormat.Value.ToSerialString(), "response_format"); + if (ResponseFormat != null) + { + content.Add(ResponseFormat.Value.ToSerialString(), "response_format"); + } } if (Optional.IsDefined(User)) { diff --git a/src/Generated/Models/ImageGenerationOptions.Serialization.cs b/src/Generated/Models/ImageGenerationOptions.Serialization.cs index 25b1d9e40..b3d5ce7c9 100644 --- a/src/Generated/Models/ImageGenerationOptions.Serialization.cs +++ b/src/Generated/Models/ImageGenerationOptions.Serialization.cs @@ -54,18 +54,39 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReader } if (Optional.IsDefined(ResponseFormat)) { - writer.WritePropertyName("response_format"u8); - writer.WriteStringValue(ResponseFormat.Value.ToSerialString()); + if (ResponseFormat != null) + { + writer.WritePropertyName("response_format"u8); + writer.WriteStringValue(ResponseFormat.Value.ToSerialString()); + } + else + { + writer.WriteNull("response_format"); + } } if (Optional.IsDefined(Size)) { - writer.WritePropertyName("size"u8); - writer.WriteStringValue(Size.Value.ToString()); + if (Size != null) + { + writer.WritePropertyName("size"u8); + writer.WriteStringValue(Size.Value.ToString()); + } + else + { + writer.WriteNull("size"); + } } if (Optional.IsDefined(Style)) { - writer.WritePropertyName("style"u8); - writer.WriteStringValue(Style.Value.ToSerialString()); + if (Style != null) + { + writer.WritePropertyName("style"u8); + writer.WriteStringValue(Style.Value.ToSerialString()); + } + else + { + writer.WriteNull("style"); + } } if (Optional.IsDefined(User)) { @@ -160,6 +181,7 @@ internal static ImageGenerationOptions DeserializeImageGenerationOptions(JsonEle { if (property.Value.ValueKind == JsonValueKind.Null) { + responseFormat = null; continue; } responseFormat = property.Value.GetString().ToGeneratedImageFormat(); @@ -169,6 +191,7 @@ internal static ImageGenerationOptions DeserializeImageGenerationOptions(JsonEle { if (property.Value.ValueKind == JsonValueKind.Null) { + size = null; continue; } size = new GeneratedImageSize(property.Value.GetString()); @@ -178,6 +201,7 @@ internal static ImageGenerationOptions DeserializeImageGenerationOptions(JsonEle { if (property.Value.ValueKind == JsonValueKind.Null) { + style = null; continue; } style = property.Value.GetString().ToGeneratedImageStyle(); diff --git a/src/Generated/Models/ImageVariationOptions.Serialization.cs b/src/Generated/Models/ImageVariationOptions.Serialization.cs index d039dab82..1c3888db9 100644 --- a/src/Generated/Models/ImageVariationOptions.Serialization.cs +++ b/src/Generated/Models/ImageVariationOptions.Serialization.cs @@ -57,13 +57,27 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderW } if (Optional.IsDefined(ResponseFormat)) { - writer.WritePropertyName("response_format"u8); - writer.WriteStringValue(ResponseFormat.Value.ToSerialString()); + if (ResponseFormat != null) + { + writer.WritePropertyName("response_format"u8); + writer.WriteStringValue(ResponseFormat.Value.ToSerialString()); + } + else + { + writer.WriteNull("response_format"); + } } if (Optional.IsDefined(Size)) { - writer.WritePropertyName("size"u8); - writer.WriteStringValue(Size.Value.ToString()); + if (Size != null) + { + writer.WritePropertyName("size"u8); + writer.WriteStringValue(Size.Value.ToString()); + } + else + { + writer.WriteNull("size"); + } } if (Optional.IsDefined(User)) { @@ -147,6 +161,7 @@ internal static ImageVariationOptions DeserializeImageVariationOptions(JsonEleme { if (property.Value.ValueKind == JsonValueKind.Null) { + responseFormat = null; continue; } responseFormat = property.Value.GetString().ToGeneratedImageFormat(); @@ -156,6 +171,7 @@ internal static ImageVariationOptions DeserializeImageVariationOptions(JsonEleme { if (property.Value.ValueKind == JsonValueKind.Null) { + size = null; continue; } size = new GeneratedImageSize(property.Value.GetString()); @@ -217,11 +233,17 @@ internal virtual MultipartFormDataBinaryContent ToMultipartBinaryBody() } if (Optional.IsDefined(ResponseFormat)) { - content.Add(ResponseFormat.Value.ToSerialString(), "response_format"); + if (ResponseFormat != null) + { + content.Add(ResponseFormat.Value.ToSerialString(), "response_format"); + } } if (Optional.IsDefined(Size)) { - content.Add(Size.Value.ToString(), "size"); + if (Size != null) + { + content.Add(Size.Value.ToString(), "size"); + } } if (Optional.IsDefined(User)) { diff --git a/src/Generated/Models/InternalAssistantToolsFileSearchTypeOnly.Serialization.cs b/src/Generated/Models/InternalAssistantToolsFileSearchTypeOnly.Serialization.cs index ba4a8c833..7e1084aba 100644 --- a/src/Generated/Models/InternalAssistantToolsFileSearchTypeOnly.Serialization.cs +++ b/src/Generated/Models/InternalAssistantToolsFileSearchTypeOnly.Serialization.cs @@ -7,11 +7,10 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using OpenAI.Internal.Models; -namespace OpenAI.Internal.Assistants +namespace OpenAI.Assistants { - internal partial struct InternalAssistantToolsFileSearchTypeOnly : IJsonModel, IJsonModel + internal partial class InternalAssistantToolsFileSearchTypeOnly : IJsonModel { void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { @@ -54,22 +53,22 @@ InternalAssistantToolsFileSearchTypeOnly IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)this).Write(writer, options); - - object IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)this).Create(ref reader, options); - internal static InternalAssistantToolsFileSearchTypeOnly DeserializeInternalAssistantToolsFileSearchTypeOnly(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; - AssistantToolsFileSearchTypeOnlyType type = default; + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + InternalAssistantToolsFileSearchTypeOnlyType type = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("type"u8)) { - type = new AssistantToolsFileSearchTypeOnlyType(property.Value.GetString()); + type = new InternalAssistantToolsFileSearchTypeOnlyType(property.Value.GetString()); continue; } if (true) @@ -112,19 +111,13 @@ InternalAssistantToolsFileSearchTypeOnly IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ((IPersistableModel)this).Write(options); - - object IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ((IPersistableModel)this).Create(data, options); - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)this).GetFormatFromOptions(options); - internal static InternalAssistantToolsFileSearchTypeOnly FromResponse(PipelineResponse response) { using var document = JsonDocument.Parse(response.Content); return DeserializeInternalAssistantToolsFileSearchTypeOnly(document.RootElement); } - internal BinaryContent ToBinaryContent() + internal virtual BinaryContent ToBinaryContent() { return BinaryContent.Create(this, ModelSerializationExtensions.WireOptions); } diff --git a/src/Generated/Models/InternalAssistantToolsFileSearchTypeOnly.cs b/src/Generated/Models/InternalAssistantToolsFileSearchTypeOnly.cs index c84929a86..c23b48b6c 100644 --- a/src/Generated/Models/InternalAssistantToolsFileSearchTypeOnly.cs +++ b/src/Generated/Models/InternalAssistantToolsFileSearchTypeOnly.cs @@ -4,29 +4,23 @@ using System; using System.Collections.Generic; -using OpenAI.Internal.Models; -namespace OpenAI.Internal.Assistants +namespace OpenAI.Assistants { - internal readonly partial struct InternalAssistantToolsFileSearchTypeOnly + internal partial class InternalAssistantToolsFileSearchTypeOnly { - private readonly IDictionary _serializedAdditionalRawData; + internal IDictionary _serializedAdditionalRawData; - public InternalAssistantToolsFileSearchTypeOnly(AssistantToolsFileSearchTypeOnlyType type) + public InternalAssistantToolsFileSearchTypeOnly() { - Type = type; } - internal InternalAssistantToolsFileSearchTypeOnly(AssistantToolsFileSearchTypeOnlyType type, IDictionary serializedAdditionalRawData) + internal InternalAssistantToolsFileSearchTypeOnly(InternalAssistantToolsFileSearchTypeOnlyType type, IDictionary serializedAdditionalRawData) { Type = type; _serializedAdditionalRawData = serializedAdditionalRawData; } - public InternalAssistantToolsFileSearchTypeOnly() - { - } - - public AssistantToolsFileSearchTypeOnlyType Type { get; } = AssistantToolsFileSearchTypeOnlyType.FileSearch; + public InternalAssistantToolsFileSearchTypeOnlyType Type { get; } = InternalAssistantToolsFileSearchTypeOnlyType.FileSearch; } } diff --git a/src/Generated/Models/InternalAssistantToolsFileSearchTypeOnlyType.cs b/src/Generated/Models/InternalAssistantToolsFileSearchTypeOnlyType.cs new file mode 100644 index 000000000..699f91c98 --- /dev/null +++ b/src/Generated/Models/InternalAssistantToolsFileSearchTypeOnlyType.cs @@ -0,0 +1,34 @@ +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace OpenAI.Assistants +{ + internal readonly partial struct InternalAssistantToolsFileSearchTypeOnlyType : IEquatable + { + private readonly string _value; + + public InternalAssistantToolsFileSearchTypeOnlyType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string FileSearchValue = "file_search"; + + public static InternalAssistantToolsFileSearchTypeOnlyType FileSearch { get; } = new InternalAssistantToolsFileSearchTypeOnlyType(FileSearchValue); + public static bool operator ==(InternalAssistantToolsFileSearchTypeOnlyType left, InternalAssistantToolsFileSearchTypeOnlyType right) => left.Equals(right); + public static bool operator !=(InternalAssistantToolsFileSearchTypeOnlyType left, InternalAssistantToolsFileSearchTypeOnlyType right) => !left.Equals(right); + public static implicit operator InternalAssistantToolsFileSearchTypeOnlyType(string value) => new InternalAssistantToolsFileSearchTypeOnlyType(value); + + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is InternalAssistantToolsFileSearchTypeOnlyType other && Equals(other); + public bool Equals(InternalAssistantToolsFileSearchTypeOnlyType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + public override string ToString() => _value; + } +} diff --git a/src/Generated/Models/InternalAssistantsNamedToolChoiceType.cs b/src/Generated/Models/InternalAssistantsNamedToolChoiceType.cs new file mode 100644 index 000000000..436be9371 --- /dev/null +++ b/src/Generated/Models/InternalAssistantsNamedToolChoiceType.cs @@ -0,0 +1,38 @@ +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace OpenAI.Assistants +{ + internal readonly partial struct InternalAssistantsNamedToolChoiceType : IEquatable + { + private readonly string _value; + + public InternalAssistantsNamedToolChoiceType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string FunctionValue = "function"; + private const string CodeInterpreterValue = "code_interpreter"; + private const string FileSearchValue = "file_search"; + + public static InternalAssistantsNamedToolChoiceType Function { get; } = new InternalAssistantsNamedToolChoiceType(FunctionValue); + public static InternalAssistantsNamedToolChoiceType CodeInterpreter { get; } = new InternalAssistantsNamedToolChoiceType(CodeInterpreterValue); + public static InternalAssistantsNamedToolChoiceType FileSearch { get; } = new InternalAssistantsNamedToolChoiceType(FileSearchValue); + public static bool operator ==(InternalAssistantsNamedToolChoiceType left, InternalAssistantsNamedToolChoiceType right) => left.Equals(right); + public static bool operator !=(InternalAssistantsNamedToolChoiceType left, InternalAssistantsNamedToolChoiceType right) => !left.Equals(right); + public static implicit operator InternalAssistantsNamedToolChoiceType(string value) => new InternalAssistantsNamedToolChoiceType(value); + + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is InternalAssistantsNamedToolChoiceType other && Equals(other); + public bool Equals(InternalAssistantsNamedToolChoiceType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + public override string ToString() => _value; + } +} diff --git a/src/Generated/Models/InternalAutoChunkingStrategy.cs b/src/Generated/Models/InternalAutoChunkingStrategy.cs index 737fe05c3..09a132829 100644 --- a/src/Generated/Models/InternalAutoChunkingStrategy.cs +++ b/src/Generated/Models/InternalAutoChunkingStrategy.cs @@ -9,7 +9,7 @@ namespace OpenAI.VectorStores { internal partial class InternalAutoChunkingStrategy : FileChunkingStrategy { - internal InternalAutoChunkingStrategy() + public InternalAutoChunkingStrategy() { Type = "auto"; } diff --git a/src/Generated/Models/InternalBatchJob.Serialization.cs b/src/Generated/Models/InternalBatchJob.Serialization.cs index c4d709426..2d123a357 100644 --- a/src/Generated/Models/InternalBatchJob.Serialization.cs +++ b/src/Generated/Models/InternalBatchJob.Serialization.cs @@ -157,7 +157,7 @@ internal static InternalBatchJob DeserializeInternalBatchJob(JsonElement element InternalBatchErrors errors = default; string inputFileId = default; string completionWindow = default; - InternalBatchJobStatus status = default; + InternalBatchStatus status = default; string outputFileId = default; string errorFileId = default; DateTimeOffset createdAt = default; @@ -211,7 +211,7 @@ internal static InternalBatchJob DeserializeInternalBatchJob(JsonElement element } if (property.NameEquals("status"u8)) { - status = new InternalBatchJobStatus(property.Value.GetString()); + status = new InternalBatchStatus(property.Value.GetString()); continue; } if (property.NameEquals("output_file_id"u8)) diff --git a/src/Generated/Models/InternalBatchJob.cs b/src/Generated/Models/InternalBatchJob.cs index eda32d82b..8cd8558b7 100644 --- a/src/Generated/Models/InternalBatchJob.cs +++ b/src/Generated/Models/InternalBatchJob.cs @@ -11,7 +11,7 @@ internal partial class InternalBatchJob { internal IDictionary _serializedAdditionalRawData; - internal InternalBatchJob(string id, string endpoint, string inputFileId, string completionWindow, InternalBatchJobStatus status, DateTimeOffset createdAt) + internal InternalBatchJob(string id, string endpoint, string inputFileId, string completionWindow, InternalBatchStatus status, DateTimeOffset createdAt) { Argument.AssertNotNull(id, nameof(id)); Argument.AssertNotNull(endpoint, nameof(endpoint)); @@ -27,7 +27,7 @@ internal InternalBatchJob(string id, string endpoint, string inputFileId, string Metadata = new ChangeTrackingDictionary(); } - internal InternalBatchJob(string id, InternalBatchObject @object, string endpoint, InternalBatchErrors errors, string inputFileId, string completionWindow, InternalBatchJobStatus status, string outputFileId, string errorFileId, DateTimeOffset createdAt, DateTimeOffset? inProgressAt, DateTimeOffset? expiresAt, DateTimeOffset? finalizingAt, DateTimeOffset? completedAt, DateTimeOffset? failedAt, DateTimeOffset? expiredAt, DateTimeOffset? cancellingAt, DateTimeOffset? cancelledAt, InternalBatchRequestCounts requestCounts, IReadOnlyDictionary metadata, IDictionary serializedAdditionalRawData) + internal InternalBatchJob(string id, InternalBatchObject @object, string endpoint, InternalBatchErrors errors, string inputFileId, string completionWindow, InternalBatchStatus status, string outputFileId, string errorFileId, DateTimeOffset createdAt, DateTimeOffset? inProgressAt, DateTimeOffset? expiresAt, DateTimeOffset? finalizingAt, DateTimeOffset? completedAt, DateTimeOffset? failedAt, DateTimeOffset? expiredAt, DateTimeOffset? cancellingAt, DateTimeOffset? cancelledAt, InternalBatchRequestCounts requestCounts, IReadOnlyDictionary metadata, IDictionary serializedAdditionalRawData) { Id = id; Object = @object; @@ -63,7 +63,7 @@ internal InternalBatchJob() public InternalBatchErrors Errors { get; } public string InputFileId { get; } public string CompletionWindow { get; } - public InternalBatchJobStatus Status { get; } + public InternalBatchStatus Status { get; } public string OutputFileId { get; } public string ErrorFileId { get; } public DateTimeOffset CreatedAt { get; } diff --git a/src/Generated/Models/InternalBatchJobStatus.cs b/src/Generated/Models/InternalBatchJobStatus.cs deleted file mode 100644 index 97a3438ad..000000000 --- a/src/Generated/Models/InternalBatchJobStatus.cs +++ /dev/null @@ -1,48 +0,0 @@ -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace OpenAI.Batch -{ - internal readonly partial struct InternalBatchJobStatus : IEquatable - { - private readonly string _value; - - public InternalBatchJobStatus(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string ValidatingValue = "validating"; - private const string FailedValue = "failed"; - private const string InProgressValue = "in_progress"; - private const string FinalizingValue = "finalizing"; - private const string CompletedValue = "completed"; - private const string ExpiredValue = "expired"; - private const string CancellingValue = "cancelling"; - private const string CancelledValue = "cancelled"; - - public static InternalBatchJobStatus Validating { get; } = new InternalBatchJobStatus(ValidatingValue); - public static InternalBatchJobStatus Failed { get; } = new InternalBatchJobStatus(FailedValue); - public static InternalBatchJobStatus InProgress { get; } = new InternalBatchJobStatus(InProgressValue); - public static InternalBatchJobStatus Finalizing { get; } = new InternalBatchJobStatus(FinalizingValue); - public static InternalBatchJobStatus Completed { get; } = new InternalBatchJobStatus(CompletedValue); - public static InternalBatchJobStatus Expired { get; } = new InternalBatchJobStatus(ExpiredValue); - public static InternalBatchJobStatus Cancelling { get; } = new InternalBatchJobStatus(CancellingValue); - public static InternalBatchJobStatus Cancelled { get; } = new InternalBatchJobStatus(CancelledValue); - public static bool operator ==(InternalBatchJobStatus left, InternalBatchJobStatus right) => left.Equals(right); - public static bool operator !=(InternalBatchJobStatus left, InternalBatchJobStatus right) => !left.Equals(right); - public static implicit operator InternalBatchJobStatus(string value) => new InternalBatchJobStatus(value); - - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is InternalBatchJobStatus other && Equals(other); - public bool Equals(InternalBatchJobStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; - public override string ToString() => _value; - } -} diff --git a/src/Generated/Models/InternalBatchOperationEndpoint.cs b/src/Generated/Models/InternalBatchOperationEndpoint.cs deleted file mode 100644 index f631d999c..000000000 --- a/src/Generated/Models/InternalBatchOperationEndpoint.cs +++ /dev/null @@ -1,36 +0,0 @@ -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace OpenAI.Batch -{ - internal readonly partial struct InternalBatchOperationEndpoint : IEquatable - { - private readonly string _value; - - public InternalBatchOperationEndpoint(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string V1ChatCompletionsValue = "/v1/chat/completions"; - private const string V1EmbeddingsValue = "/v1/embeddings"; - - public static InternalBatchOperationEndpoint V1ChatCompletions { get; } = new InternalBatchOperationEndpoint(V1ChatCompletionsValue); - public static InternalBatchOperationEndpoint V1Embeddings { get; } = new InternalBatchOperationEndpoint(V1EmbeddingsValue); - public static bool operator ==(InternalBatchOperationEndpoint left, InternalBatchOperationEndpoint right) => left.Equals(right); - public static bool operator !=(InternalBatchOperationEndpoint left, InternalBatchOperationEndpoint right) => !left.Equals(right); - public static implicit operator InternalBatchOperationEndpoint(string value) => new InternalBatchOperationEndpoint(value); - - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is InternalBatchOperationEndpoint other && Equals(other); - public bool Equals(InternalBatchOperationEndpoint other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; - public override string ToString() => _value; - } -} diff --git a/src/Generated/Models/InternalBatchRequestInput.Serialization.cs b/src/Generated/Models/InternalBatchRequestInput.Serialization.cs index 8b7ef98b5..4bd2be752 100644 --- a/src/Generated/Models/InternalBatchRequestInput.Serialization.cs +++ b/src/Generated/Models/InternalBatchRequestInput.Serialization.cs @@ -29,7 +29,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRea if (Optional.IsDefined(Method)) { writer.WritePropertyName("method"u8); - writer.WriteStringValue(Method); + writer.WriteStringValue(Method.Value.ToString()); } if (Optional.IsDefined(Url)) { @@ -75,7 +75,7 @@ internal static InternalBatchRequestInput DeserializeInternalBatchRequestInput(J return null; } string customId = default; - string method = default; + InternalBatchRequestInputMethod? method = default; Uri url = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); @@ -88,7 +88,11 @@ internal static InternalBatchRequestInput DeserializeInternalBatchRequestInput(J } if (property.NameEquals("method"u8)) { - method = property.Value.GetString(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + method = new InternalBatchRequestInputMethod(property.Value.GetString()); continue; } if (property.NameEquals("url"u8)) diff --git a/src/Generated/Models/InternalBatchRequestInput.cs b/src/Generated/Models/InternalBatchRequestInput.cs index 988b19e88..326f116b7 100644 --- a/src/Generated/Models/InternalBatchRequestInput.cs +++ b/src/Generated/Models/InternalBatchRequestInput.cs @@ -11,11 +11,11 @@ internal partial class InternalBatchRequestInput { internal IDictionary _serializedAdditionalRawData; - internal InternalBatchRequestInput() + public InternalBatchRequestInput() { } - internal InternalBatchRequestInput(string customId, string method, Uri url, IDictionary serializedAdditionalRawData) + internal InternalBatchRequestInput(string customId, InternalBatchRequestInputMethod? method, Uri url, IDictionary serializedAdditionalRawData) { CustomId = customId; Method = method; @@ -23,8 +23,8 @@ internal InternalBatchRequestInput(string customId, string method, Uri url, IDic _serializedAdditionalRawData = serializedAdditionalRawData; } - public string CustomId { get; } - public string Method { get; } - public Uri Url { get; } + public string CustomId { get; set; } + public InternalBatchRequestInputMethod? Method { get; set; } + public Uri Url { get; set; } } } diff --git a/src/Generated/Models/InternalBatchStatus.cs b/src/Generated/Models/InternalBatchStatus.cs new file mode 100644 index 000000000..da25caf11 --- /dev/null +++ b/src/Generated/Models/InternalBatchStatus.cs @@ -0,0 +1,48 @@ +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace OpenAI.Batch +{ + internal readonly partial struct InternalBatchStatus : IEquatable + { + private readonly string _value; + + public InternalBatchStatus(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ValidatingValue = "validating"; + private const string FailedValue = "failed"; + private const string InProgressValue = "in_progress"; + private const string FinalizingValue = "finalizing"; + private const string CompletedValue = "completed"; + private const string ExpiredValue = "expired"; + private const string CancellingValue = "cancelling"; + private const string CancelledValue = "cancelled"; + + public static InternalBatchStatus Validating { get; } = new InternalBatchStatus(ValidatingValue); + public static InternalBatchStatus Failed { get; } = new InternalBatchStatus(FailedValue); + public static InternalBatchStatus InProgress { get; } = new InternalBatchStatus(InProgressValue); + public static InternalBatchStatus Finalizing { get; } = new InternalBatchStatus(FinalizingValue); + public static InternalBatchStatus Completed { get; } = new InternalBatchStatus(CompletedValue); + public static InternalBatchStatus Expired { get; } = new InternalBatchStatus(ExpiredValue); + public static InternalBatchStatus Cancelling { get; } = new InternalBatchStatus(CancellingValue); + public static InternalBatchStatus Cancelled { get; } = new InternalBatchStatus(CancelledValue); + public static bool operator ==(InternalBatchStatus left, InternalBatchStatus right) => left.Equals(right); + public static bool operator !=(InternalBatchStatus left, InternalBatchStatus right) => !left.Equals(right); + public static implicit operator InternalBatchStatus(string value) => new InternalBatchStatus(value); + + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is InternalBatchStatus other && Equals(other); + public bool Equals(InternalBatchStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + public override string ToString() => _value; + } +} diff --git a/src/Generated/Models/InternalChatResponseFormatType.cs b/src/Generated/Models/InternalChatResponseFormatType.cs deleted file mode 100644 index f6e5fa1d8..000000000 --- a/src/Generated/Models/InternalChatResponseFormatType.cs +++ /dev/null @@ -1,36 +0,0 @@ -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace OpenAI.Chat -{ - internal readonly partial struct InternalChatResponseFormatType : IEquatable - { - private readonly string _value; - - public InternalChatResponseFormatType(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string TextValue = "text"; - private const string JsonObjectValue = "json_object"; - - public static InternalChatResponseFormatType Text { get; } = new InternalChatResponseFormatType(TextValue); - public static InternalChatResponseFormatType JsonObject { get; } = new InternalChatResponseFormatType(JsonObjectValue); - public static bool operator ==(InternalChatResponseFormatType left, InternalChatResponseFormatType right) => left.Equals(right); - public static bool operator !=(InternalChatResponseFormatType left, InternalChatResponseFormatType right) => !left.Equals(right); - public static implicit operator InternalChatResponseFormatType(string value) => new InternalChatResponseFormatType(value); - - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is InternalChatResponseFormatType other && Equals(other); - public bool Equals(InternalChatResponseFormatType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; - public override string ToString() => _value; - } -} diff --git a/src/Generated/Models/InternalCreateAssistantRequestResponseFormat.cs b/src/Generated/Models/InternalCreateAssistantRequestResponseFormat.cs new file mode 100644 index 000000000..1d6ca009d --- /dev/null +++ b/src/Generated/Models/InternalCreateAssistantRequestResponseFormat.cs @@ -0,0 +1,36 @@ +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace OpenAI.Assistants +{ + internal readonly partial struct InternalCreateAssistantRequestResponseFormat : IEquatable + { + private readonly string _value; + + public InternalCreateAssistantRequestResponseFormat(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NoneValue = "none"; + private const string AutoValue = "auto"; + + public static InternalCreateAssistantRequestResponseFormat None { get; } = new InternalCreateAssistantRequestResponseFormat(NoneValue); + public static InternalCreateAssistantRequestResponseFormat Auto { get; } = new InternalCreateAssistantRequestResponseFormat(AutoValue); + public static bool operator ==(InternalCreateAssistantRequestResponseFormat left, InternalCreateAssistantRequestResponseFormat right) => left.Equals(right); + public static bool operator !=(InternalCreateAssistantRequestResponseFormat left, InternalCreateAssistantRequestResponseFormat right) => !left.Equals(right); + public static implicit operator InternalCreateAssistantRequestResponseFormat(string value) => new InternalCreateAssistantRequestResponseFormat(value); + + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is InternalCreateAssistantRequestResponseFormat other && Equals(other); + public bool Equals(InternalCreateAssistantRequestResponseFormat other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + public override string ToString() => _value; + } +} diff --git a/src/Generated/Models/InternalCreateAssistantRequestToolResourcesFileSearchBase.cs b/src/Generated/Models/InternalCreateAssistantRequestToolResourcesFileSearchBase.cs index 7ab27e6ee..6776d76c9 100644 --- a/src/Generated/Models/InternalCreateAssistantRequestToolResourcesFileSearchBase.cs +++ b/src/Generated/Models/InternalCreateAssistantRequestToolResourcesFileSearchBase.cs @@ -11,7 +11,7 @@ internal partial class InternalCreateAssistantRequestToolResourcesFileSearchBase { internal IDictionary _serializedAdditionalRawData; - internal InternalCreateAssistantRequestToolResourcesFileSearchBase() + public InternalCreateAssistantRequestToolResourcesFileSearchBase() { } diff --git a/src/Generated/Models/InternalCreateBatchRequest.Serialization.cs b/src/Generated/Models/InternalCreateBatchRequest.Serialization.cs index f74709c26..22aadf4b3 100644 --- a/src/Generated/Models/InternalCreateBatchRequest.Serialization.cs +++ b/src/Generated/Models/InternalCreateBatchRequest.Serialization.cs @@ -84,7 +84,7 @@ internal static InternalCreateBatchRequest DeserializeInternalCreateBatchRequest return null; } string inputFileId = default; - InternalBatchOperationEndpoint endpoint = default; + InternalCreateBatchRequestEndpoint endpoint = default; InternalBatchCompletionTimeframe completionWindow = default; IDictionary metadata = default; IDictionary serializedAdditionalRawData = default; @@ -98,7 +98,7 @@ internal static InternalCreateBatchRequest DeserializeInternalCreateBatchRequest } if (property.NameEquals("endpoint"u8)) { - endpoint = new InternalBatchOperationEndpoint(property.Value.GetString()); + endpoint = new InternalCreateBatchRequestEndpoint(property.Value.GetString()); continue; } if (property.NameEquals("completion_window"u8)) diff --git a/src/Generated/Models/InternalCreateBatchRequest.cs b/src/Generated/Models/InternalCreateBatchRequest.cs index 19388c951..dbe3be6dd 100644 --- a/src/Generated/Models/InternalCreateBatchRequest.cs +++ b/src/Generated/Models/InternalCreateBatchRequest.cs @@ -11,7 +11,7 @@ internal partial class InternalCreateBatchRequest { internal IDictionary _serializedAdditionalRawData; - public InternalCreateBatchRequest(string inputFileId, InternalBatchOperationEndpoint endpoint) + public InternalCreateBatchRequest(string inputFileId, InternalCreateBatchRequestEndpoint endpoint) { Argument.AssertNotNull(inputFileId, nameof(inputFileId)); @@ -20,7 +20,7 @@ public InternalCreateBatchRequest(string inputFileId, InternalBatchOperationEndp Metadata = new ChangeTrackingDictionary(); } - internal InternalCreateBatchRequest(string inputFileId, InternalBatchOperationEndpoint endpoint, InternalBatchCompletionTimeframe completionWindow, IDictionary metadata, IDictionary serializedAdditionalRawData) + internal InternalCreateBatchRequest(string inputFileId, InternalCreateBatchRequestEndpoint endpoint, InternalBatchCompletionTimeframe completionWindow, IDictionary metadata, IDictionary serializedAdditionalRawData) { InputFileId = inputFileId; Endpoint = endpoint; @@ -34,7 +34,7 @@ internal InternalCreateBatchRequest() } public string InputFileId { get; } - public InternalBatchOperationEndpoint Endpoint { get; } + public InternalCreateBatchRequestEndpoint Endpoint { get; } public InternalBatchCompletionTimeframe CompletionWindow { get; } = InternalBatchCompletionTimeframe._24h; public IDictionary Metadata { get; set; } diff --git a/src/Generated/Models/InternalCreateBatchRequestEndpoint.cs b/src/Generated/Models/InternalCreateBatchRequestEndpoint.cs new file mode 100644 index 000000000..899cb0c4e --- /dev/null +++ b/src/Generated/Models/InternalCreateBatchRequestEndpoint.cs @@ -0,0 +1,36 @@ +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace OpenAI.Batch +{ + internal readonly partial struct InternalCreateBatchRequestEndpoint : IEquatable + { + private readonly string _value; + + public InternalCreateBatchRequestEndpoint(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string V1ChatCompletionsValue = "/v1/chat/completions"; + private const string V1EmbeddingsValue = "/v1/embeddings"; + + public static InternalCreateBatchRequestEndpoint V1ChatCompletions { get; } = new InternalCreateBatchRequestEndpoint(V1ChatCompletionsValue); + public static InternalCreateBatchRequestEndpoint V1Embeddings { get; } = new InternalCreateBatchRequestEndpoint(V1EmbeddingsValue); + public static bool operator ==(InternalCreateBatchRequestEndpoint left, InternalCreateBatchRequestEndpoint right) => left.Equals(right); + public static bool operator !=(InternalCreateBatchRequestEndpoint left, InternalCreateBatchRequestEndpoint right) => !left.Equals(right); + public static implicit operator InternalCreateBatchRequestEndpoint(string value) => new InternalCreateBatchRequestEndpoint(value); + + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is InternalCreateBatchRequestEndpoint other && Equals(other); + public bool Equals(InternalCreateBatchRequestEndpoint other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + public override string ToString() => _value; + } +} diff --git a/src/Generated/Models/InternalCreateChatCompletionFunctionResponse.Serialization.cs b/src/Generated/Models/InternalCreateChatCompletionFunctionResponse.Serialization.cs index 400bc39d8..48c22da1e 100644 --- a/src/Generated/Models/InternalCreateChatCompletionFunctionResponse.Serialization.cs +++ b/src/Generated/Models/InternalCreateChatCompletionFunctionResponse.Serialization.cs @@ -40,7 +40,7 @@ void IJsonModel.Write(Utf8JsonWrit writer.WriteStringValue(SystemFingerprint); } writer.WritePropertyName("object"u8); - writer.WriteStringValue(Object); + writer.WriteStringValue(Object.ToString()); if (Optional.IsDefined(Usage)) { writer.WritePropertyName("usage"u8); @@ -89,7 +89,7 @@ internal static InternalCreateChatCompletionFunctionResponse DeserializeInternal DateTimeOffset created = default; string model = default; string systemFingerprint = default; - string @object = default; + InternalCreateChatCompletionFunctionResponseObject @object = default; ChatTokenUsage usage = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); @@ -127,7 +127,7 @@ internal static InternalCreateChatCompletionFunctionResponse DeserializeInternal } if (property.NameEquals("object"u8)) { - @object = property.Value.GetString(); + @object = new InternalCreateChatCompletionFunctionResponseObject(property.Value.GetString()); continue; } if (property.NameEquals("usage"u8)) diff --git a/src/Generated/Models/InternalCreateChatCompletionFunctionResponse.cs b/src/Generated/Models/InternalCreateChatCompletionFunctionResponse.cs index 150357250..d8a763b46 100644 --- a/src/Generated/Models/InternalCreateChatCompletionFunctionResponse.cs +++ b/src/Generated/Models/InternalCreateChatCompletionFunctionResponse.cs @@ -24,7 +24,7 @@ internal InternalCreateChatCompletionFunctionResponse(string id, IEnumerable choices, DateTimeOffset created, string model, string systemFingerprint, string @object, ChatTokenUsage usage, IDictionary serializedAdditionalRawData) + internal InternalCreateChatCompletionFunctionResponse(string id, IReadOnlyList choices, DateTimeOffset created, string model, string systemFingerprint, InternalCreateChatCompletionFunctionResponseObject @object, ChatTokenUsage usage, IDictionary serializedAdditionalRawData) { Id = id; Choices = choices; @@ -45,7 +45,7 @@ internal InternalCreateChatCompletionFunctionResponse() public DateTimeOffset Created { get; } public string Model { get; } public string SystemFingerprint { get; } - public string Object { get; } = "chat.completion"; + public InternalCreateChatCompletionFunctionResponseObject Object { get; } = InternalCreateChatCompletionFunctionResponseObject.ChatCompletion; public ChatTokenUsage Usage { get; } } diff --git a/src/Generated/Models/InternalCreateChatCompletionFunctionResponseChoice.Serialization.cs b/src/Generated/Models/InternalCreateChatCompletionFunctionResponseChoice.Serialization.cs index 9f2fd1aeb..6b8197775 100644 --- a/src/Generated/Models/InternalCreateChatCompletionFunctionResponseChoice.Serialization.cs +++ b/src/Generated/Models/InternalCreateChatCompletionFunctionResponseChoice.Serialization.cs @@ -22,7 +22,7 @@ void IJsonModel.Write(Utf8Js writer.WriteStartObject(); writer.WritePropertyName("finish_reason"u8); - writer.WriteStringValue(FinishReason); + writer.WriteStringValue(FinishReason.ToString()); writer.WritePropertyName("index"u8); writer.WriteNumberValue(Index); writer.WritePropertyName("message"u8); @@ -65,7 +65,7 @@ internal static InternalCreateChatCompletionFunctionResponseChoice DeserializeIn { return null; } - string finishReason = default; + InternalCreateChatCompletionFunctionResponseChoiceFinishReason finishReason = default; int index = default; InternalChatCompletionResponseMessage message = default; IDictionary serializedAdditionalRawData = default; @@ -74,7 +74,7 @@ internal static InternalCreateChatCompletionFunctionResponseChoice DeserializeIn { if (property.NameEquals("finish_reason"u8)) { - finishReason = property.Value.GetString(); + finishReason = new InternalCreateChatCompletionFunctionResponseChoiceFinishReason(property.Value.GetString()); continue; } if (property.NameEquals("index"u8)) diff --git a/src/Generated/Models/InternalCreateChatCompletionFunctionResponseChoice.cs b/src/Generated/Models/InternalCreateChatCompletionFunctionResponseChoice.cs index b3521bdcc..6e602c543 100644 --- a/src/Generated/Models/InternalCreateChatCompletionFunctionResponseChoice.cs +++ b/src/Generated/Models/InternalCreateChatCompletionFunctionResponseChoice.cs @@ -11,9 +11,8 @@ internal partial class InternalCreateChatCompletionFunctionResponseChoice { internal IDictionary _serializedAdditionalRawData; - internal InternalCreateChatCompletionFunctionResponseChoice(string finishReason, int index, InternalChatCompletionResponseMessage message) + internal InternalCreateChatCompletionFunctionResponseChoice(InternalCreateChatCompletionFunctionResponseChoiceFinishReason finishReason, int index, InternalChatCompletionResponseMessage message) { - Argument.AssertNotNull(finishReason, nameof(finishReason)); Argument.AssertNotNull(message, nameof(message)); FinishReason = finishReason; @@ -21,7 +20,7 @@ internal InternalCreateChatCompletionFunctionResponseChoice(string finishReason, Message = message; } - internal InternalCreateChatCompletionFunctionResponseChoice(string finishReason, int index, InternalChatCompletionResponseMessage message, IDictionary serializedAdditionalRawData) + internal InternalCreateChatCompletionFunctionResponseChoice(InternalCreateChatCompletionFunctionResponseChoiceFinishReason finishReason, int index, InternalChatCompletionResponseMessage message, IDictionary serializedAdditionalRawData) { FinishReason = finishReason; Index = index; @@ -33,7 +32,7 @@ internal InternalCreateChatCompletionFunctionResponseChoice() { } - public string FinishReason { get; } + public InternalCreateChatCompletionFunctionResponseChoiceFinishReason FinishReason { get; } public int Index { get; } public InternalChatCompletionResponseMessage Message { get; } } diff --git a/src/Generated/Models/InternalCreateChatCompletionRequestResponseFormatType.cs b/src/Generated/Models/InternalCreateChatCompletionRequestResponseFormatType.cs new file mode 100644 index 000000000..37d66fbf6 --- /dev/null +++ b/src/Generated/Models/InternalCreateChatCompletionRequestResponseFormatType.cs @@ -0,0 +1,36 @@ +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace OpenAI.Chat +{ + internal readonly partial struct InternalCreateChatCompletionRequestResponseFormatType : IEquatable + { + private readonly string _value; + + public InternalCreateChatCompletionRequestResponseFormatType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string TextValue = "text"; + private const string JsonObjectValue = "json_object"; + + public static InternalCreateChatCompletionRequestResponseFormatType Text { get; } = new InternalCreateChatCompletionRequestResponseFormatType(TextValue); + public static InternalCreateChatCompletionRequestResponseFormatType JsonObject { get; } = new InternalCreateChatCompletionRequestResponseFormatType(JsonObjectValue); + public static bool operator ==(InternalCreateChatCompletionRequestResponseFormatType left, InternalCreateChatCompletionRequestResponseFormatType right) => left.Equals(right); + public static bool operator !=(InternalCreateChatCompletionRequestResponseFormatType left, InternalCreateChatCompletionRequestResponseFormatType right) => !left.Equals(right); + public static implicit operator InternalCreateChatCompletionRequestResponseFormatType(string value) => new InternalCreateChatCompletionRequestResponseFormatType(value); + + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is InternalCreateChatCompletionRequestResponseFormatType other && Equals(other); + public bool Equals(InternalCreateChatCompletionRequestResponseFormatType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + public override string ToString() => _value; + } +} diff --git a/src/Generated/Models/InternalCreateChatCompletionRequestToolChoice.cs b/src/Generated/Models/InternalCreateChatCompletionRequestToolChoice.cs new file mode 100644 index 000000000..dc9dc5432 --- /dev/null +++ b/src/Generated/Models/InternalCreateChatCompletionRequestToolChoice.cs @@ -0,0 +1,38 @@ +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace OpenAI.Chat +{ + internal readonly partial struct InternalCreateChatCompletionRequestToolChoice : IEquatable + { + private readonly string _value; + + public InternalCreateChatCompletionRequestToolChoice(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NoneValue = "none"; + private const string AutoValue = "auto"; + private const string RequiredValue = "required"; + + public static InternalCreateChatCompletionRequestToolChoice None { get; } = new InternalCreateChatCompletionRequestToolChoice(NoneValue); + public static InternalCreateChatCompletionRequestToolChoice Auto { get; } = new InternalCreateChatCompletionRequestToolChoice(AutoValue); + public static InternalCreateChatCompletionRequestToolChoice Required { get; } = new InternalCreateChatCompletionRequestToolChoice(RequiredValue); + public static bool operator ==(InternalCreateChatCompletionRequestToolChoice left, InternalCreateChatCompletionRequestToolChoice right) => left.Equals(right); + public static bool operator !=(InternalCreateChatCompletionRequestToolChoice left, InternalCreateChatCompletionRequestToolChoice right) => !left.Equals(right); + public static implicit operator InternalCreateChatCompletionRequestToolChoice(string value) => new InternalCreateChatCompletionRequestToolChoice(value); + + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is InternalCreateChatCompletionRequestToolChoice other && Equals(other); + public bool Equals(InternalCreateChatCompletionRequestToolChoice other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + public override string ToString() => _value; + } +} diff --git a/src/Generated/Models/InternalCreateEmbeddingRequestEncodingFormat.cs b/src/Generated/Models/InternalCreateEmbeddingRequestEncodingFormat.cs new file mode 100644 index 000000000..e621f539f --- /dev/null +++ b/src/Generated/Models/InternalCreateEmbeddingRequestEncodingFormat.cs @@ -0,0 +1,36 @@ +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace OpenAI.Embeddings +{ + internal readonly partial struct InternalCreateEmbeddingRequestEncodingFormat : IEquatable + { + private readonly string _value; + + public InternalCreateEmbeddingRequestEncodingFormat(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string FloatValue = "float"; + private const string Base64Value = "base64"; + + public static InternalCreateEmbeddingRequestEncodingFormat Float { get; } = new InternalCreateEmbeddingRequestEncodingFormat(FloatValue); + public static InternalCreateEmbeddingRequestEncodingFormat Base64 { get; } = new InternalCreateEmbeddingRequestEncodingFormat(Base64Value); + public static bool operator ==(InternalCreateEmbeddingRequestEncodingFormat left, InternalCreateEmbeddingRequestEncodingFormat right) => left.Equals(right); + public static bool operator !=(InternalCreateEmbeddingRequestEncodingFormat left, InternalCreateEmbeddingRequestEncodingFormat right) => !left.Equals(right); + public static implicit operator InternalCreateEmbeddingRequestEncodingFormat(string value) => new InternalCreateEmbeddingRequestEncodingFormat(value); + + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is InternalCreateEmbeddingRequestEncodingFormat other && Equals(other); + public bool Equals(InternalCreateEmbeddingRequestEncodingFormat other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + public override string ToString() => _value; + } +} diff --git a/src/Generated/Models/InternalCreateImageEditRequestResponseFormat.cs b/src/Generated/Models/InternalCreateImageEditRequestResponseFormat.cs new file mode 100644 index 000000000..f068ed8d1 --- /dev/null +++ b/src/Generated/Models/InternalCreateImageEditRequestResponseFormat.cs @@ -0,0 +1,36 @@ +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace OpenAI.Images +{ + internal readonly partial struct InternalCreateImageEditRequestResponseFormat : IEquatable + { + private readonly string _value; + + public InternalCreateImageEditRequestResponseFormat(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UrlValue = "url"; + private const string B64JsonValue = "b64_json"; + + public static InternalCreateImageEditRequestResponseFormat Url { get; } = new InternalCreateImageEditRequestResponseFormat(UrlValue); + public static InternalCreateImageEditRequestResponseFormat B64Json { get; } = new InternalCreateImageEditRequestResponseFormat(B64JsonValue); + public static bool operator ==(InternalCreateImageEditRequestResponseFormat left, InternalCreateImageEditRequestResponseFormat right) => left.Equals(right); + public static bool operator !=(InternalCreateImageEditRequestResponseFormat left, InternalCreateImageEditRequestResponseFormat right) => !left.Equals(right); + public static implicit operator InternalCreateImageEditRequestResponseFormat(string value) => new InternalCreateImageEditRequestResponseFormat(value); + + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is InternalCreateImageEditRequestResponseFormat other && Equals(other); + public bool Equals(InternalCreateImageEditRequestResponseFormat other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + public override string ToString() => _value; + } +} diff --git a/src/Generated/Models/InternalCreateImageEditRequestSize.cs b/src/Generated/Models/InternalCreateImageEditRequestSize.cs new file mode 100644 index 000000000..b6ec08eb0 --- /dev/null +++ b/src/Generated/Models/InternalCreateImageEditRequestSize.cs @@ -0,0 +1,38 @@ +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace OpenAI.Images +{ + internal readonly partial struct InternalCreateImageEditRequestSize : IEquatable + { + private readonly string _value; + + public InternalCreateImageEditRequestSize(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string _256x256Value = "256x256"; + private const string _512x512Value = "512x512"; + private const string _1024x1024Value = "1024x1024"; + + public static InternalCreateImageEditRequestSize _256x256 { get; } = new InternalCreateImageEditRequestSize(_256x256Value); + public static InternalCreateImageEditRequestSize _512x512 { get; } = new InternalCreateImageEditRequestSize(_512x512Value); + public static InternalCreateImageEditRequestSize _1024x1024 { get; } = new InternalCreateImageEditRequestSize(_1024x1024Value); + public static bool operator ==(InternalCreateImageEditRequestSize left, InternalCreateImageEditRequestSize right) => left.Equals(right); + public static bool operator !=(InternalCreateImageEditRequestSize left, InternalCreateImageEditRequestSize right) => !left.Equals(right); + public static implicit operator InternalCreateImageEditRequestSize(string value) => new InternalCreateImageEditRequestSize(value); + + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is InternalCreateImageEditRequestSize other && Equals(other); + public bool Equals(InternalCreateImageEditRequestSize other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + public override string ToString() => _value; + } +} diff --git a/src/Generated/Models/InternalCreateImageVariationRequestResponseFormat.cs b/src/Generated/Models/InternalCreateImageVariationRequestResponseFormat.cs new file mode 100644 index 000000000..257f6d1f8 --- /dev/null +++ b/src/Generated/Models/InternalCreateImageVariationRequestResponseFormat.cs @@ -0,0 +1,36 @@ +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace OpenAI.Images +{ + internal readonly partial struct InternalCreateImageVariationRequestResponseFormat : IEquatable + { + private readonly string _value; + + public InternalCreateImageVariationRequestResponseFormat(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UrlValue = "url"; + private const string B64JsonValue = "b64_json"; + + public static InternalCreateImageVariationRequestResponseFormat Url { get; } = new InternalCreateImageVariationRequestResponseFormat(UrlValue); + public static InternalCreateImageVariationRequestResponseFormat B64Json { get; } = new InternalCreateImageVariationRequestResponseFormat(B64JsonValue); + public static bool operator ==(InternalCreateImageVariationRequestResponseFormat left, InternalCreateImageVariationRequestResponseFormat right) => left.Equals(right); + public static bool operator !=(InternalCreateImageVariationRequestResponseFormat left, InternalCreateImageVariationRequestResponseFormat right) => !left.Equals(right); + public static implicit operator InternalCreateImageVariationRequestResponseFormat(string value) => new InternalCreateImageVariationRequestResponseFormat(value); + + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is InternalCreateImageVariationRequestResponseFormat other && Equals(other); + public bool Equals(InternalCreateImageVariationRequestResponseFormat other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + public override string ToString() => _value; + } +} diff --git a/src/Generated/Models/InternalCreateImageVariationRequestSize.cs b/src/Generated/Models/InternalCreateImageVariationRequestSize.cs new file mode 100644 index 000000000..f1b93fffe --- /dev/null +++ b/src/Generated/Models/InternalCreateImageVariationRequestSize.cs @@ -0,0 +1,38 @@ +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace OpenAI.Images +{ + internal readonly partial struct InternalCreateImageVariationRequestSize : IEquatable + { + private readonly string _value; + + public InternalCreateImageVariationRequestSize(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string _256x256Value = "256x256"; + private const string _512x512Value = "512x512"; + private const string _1024x1024Value = "1024x1024"; + + public static InternalCreateImageVariationRequestSize _256x256 { get; } = new InternalCreateImageVariationRequestSize(_256x256Value); + public static InternalCreateImageVariationRequestSize _512x512 { get; } = new InternalCreateImageVariationRequestSize(_512x512Value); + public static InternalCreateImageVariationRequestSize _1024x1024 { get; } = new InternalCreateImageVariationRequestSize(_1024x1024Value); + public static bool operator ==(InternalCreateImageVariationRequestSize left, InternalCreateImageVariationRequestSize right) => left.Equals(right); + public static bool operator !=(InternalCreateImageVariationRequestSize left, InternalCreateImageVariationRequestSize right) => !left.Equals(right); + public static implicit operator InternalCreateImageVariationRequestSize(string value) => new InternalCreateImageVariationRequestSize(value); + + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is InternalCreateImageVariationRequestSize other && Equals(other); + public bool Equals(InternalCreateImageVariationRequestSize other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + public override string ToString() => _value; + } +} diff --git a/src/Generated/Models/InternalCreateThreadAndRunRequest.Serialization.cs b/src/Generated/Models/InternalCreateThreadAndRunRequest.Serialization.cs index 3c826f8aa..ae77d4498 100644 --- a/src/Generated/Models/InternalCreateThreadAndRunRequest.Serialization.cs +++ b/src/Generated/Models/InternalCreateThreadAndRunRequest.Serialization.cs @@ -171,6 +171,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, writer.WriteNull("truncation_strategy"); } } + // CUSTOM: Made nullable. if (Optional.IsDefined(ToolChoice)) { if (ToolChoice != null) @@ -188,6 +189,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, writer.WritePropertyName("parallel_tool_calls"u8); writer.WriteBooleanValue(ParallelToolCalls.Value); } + // CUSTOM: Made nullable. if (Optional.IsDefined(ResponseFormat)) { if (ResponseFormat != null) @@ -390,6 +392,7 @@ internal static InternalCreateThreadAndRunRequest DeserializeInternalCreateThrea truncationStrategy = RunTruncationStrategy.DeserializeRunTruncationStrategy(property.Value, options); continue; } + // CUSTOM: Made nullable. if (property.NameEquals("tool_choice"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -409,6 +412,7 @@ internal static InternalCreateThreadAndRunRequest DeserializeInternalCreateThrea parallelToolCalls = property.Value.GetBoolean(); continue; } + // CUSTOM: Made nullable. if (property.NameEquals("response_format"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) diff --git a/src/Generated/Models/InternalCreateThreadAndRunRequestToolChoice.cs b/src/Generated/Models/InternalCreateThreadAndRunRequestToolChoice.cs new file mode 100644 index 000000000..ab8211445 --- /dev/null +++ b/src/Generated/Models/InternalCreateThreadAndRunRequestToolChoice.cs @@ -0,0 +1,38 @@ +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace OpenAI.Assistants +{ + internal readonly partial struct InternalCreateThreadAndRunRequestToolChoice : IEquatable + { + private readonly string _value; + + public InternalCreateThreadAndRunRequestToolChoice(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NoneValue = "none"; + private const string AutoValue = "auto"; + private const string RequiredValue = "required"; + + public static InternalCreateThreadAndRunRequestToolChoice None { get; } = new InternalCreateThreadAndRunRequestToolChoice(NoneValue); + public static InternalCreateThreadAndRunRequestToolChoice Auto { get; } = new InternalCreateThreadAndRunRequestToolChoice(AutoValue); + public static InternalCreateThreadAndRunRequestToolChoice Required { get; } = new InternalCreateThreadAndRunRequestToolChoice(RequiredValue); + public static bool operator ==(InternalCreateThreadAndRunRequestToolChoice left, InternalCreateThreadAndRunRequestToolChoice right) => left.Equals(right); + public static bool operator !=(InternalCreateThreadAndRunRequestToolChoice left, InternalCreateThreadAndRunRequestToolChoice right) => !left.Equals(right); + public static implicit operator InternalCreateThreadAndRunRequestToolChoice(string value) => new InternalCreateThreadAndRunRequestToolChoice(value); + + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is InternalCreateThreadAndRunRequestToolChoice other && Equals(other); + public bool Equals(InternalCreateThreadAndRunRequestToolChoice other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + public override string ToString() => _value; + } +} diff --git a/src/Generated/Models/InternalCreateThreadRequestToolResourcesFileSearchBase.cs b/src/Generated/Models/InternalCreateThreadRequestToolResourcesFileSearchBase.cs index a607bd8d4..a939d47aa 100644 --- a/src/Generated/Models/InternalCreateThreadRequestToolResourcesFileSearchBase.cs +++ b/src/Generated/Models/InternalCreateThreadRequestToolResourcesFileSearchBase.cs @@ -11,7 +11,7 @@ internal partial class InternalCreateThreadRequestToolResourcesFileSearchBase { internal IDictionary _serializedAdditionalRawData; - internal InternalCreateThreadRequestToolResourcesFileSearchBase() + public InternalCreateThreadRequestToolResourcesFileSearchBase() { } diff --git a/src/Generated/Models/InternalCreateTranscriptionRequestTimestampGranularity.cs b/src/Generated/Models/InternalCreateTranscriptionRequestTimestampGranularity.cs new file mode 100644 index 000000000..9c047bbd7 --- /dev/null +++ b/src/Generated/Models/InternalCreateTranscriptionRequestTimestampGranularity.cs @@ -0,0 +1,36 @@ +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace OpenAI.Audio +{ + internal readonly partial struct InternalCreateTranscriptionRequestTimestampGranularity : IEquatable + { + private readonly string _value; + + public InternalCreateTranscriptionRequestTimestampGranularity(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string WordValue = "word"; + private const string SegmentValue = "segment"; + + public static InternalCreateTranscriptionRequestTimestampGranularity Word { get; } = new InternalCreateTranscriptionRequestTimestampGranularity(WordValue); + public static InternalCreateTranscriptionRequestTimestampGranularity Segment { get; } = new InternalCreateTranscriptionRequestTimestampGranularity(SegmentValue); + public static bool operator ==(InternalCreateTranscriptionRequestTimestampGranularity left, InternalCreateTranscriptionRequestTimestampGranularity right) => left.Equals(right); + public static bool operator !=(InternalCreateTranscriptionRequestTimestampGranularity left, InternalCreateTranscriptionRequestTimestampGranularity right) => !left.Equals(right); + public static implicit operator InternalCreateTranscriptionRequestTimestampGranularity(string value) => new InternalCreateTranscriptionRequestTimestampGranularity(value); + + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is InternalCreateTranscriptionRequestTimestampGranularity other && Equals(other); + public bool Equals(InternalCreateTranscriptionRequestTimestampGranularity other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + public override string ToString() => _value; + } +} diff --git a/src/Generated/Models/InternalEmbeddingGenerationOptionsEncodingFormat.cs b/src/Generated/Models/InternalEmbeddingGenerationOptionsEncodingFormat.cs deleted file mode 100644 index 7bb87f18e..000000000 --- a/src/Generated/Models/InternalEmbeddingGenerationOptionsEncodingFormat.cs +++ /dev/null @@ -1,36 +0,0 @@ -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace OpenAI.Embeddings -{ - internal readonly partial struct InternalEmbeddingGenerationOptionsEncodingFormat : IEquatable - { - private readonly string _value; - - public InternalEmbeddingGenerationOptionsEncodingFormat(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string FloatValue = "float"; - private const string Base64Value = "base64"; - - public static InternalEmbeddingGenerationOptionsEncodingFormat Float { get; } = new InternalEmbeddingGenerationOptionsEncodingFormat(FloatValue); - public static InternalEmbeddingGenerationOptionsEncodingFormat Base64 { get; } = new InternalEmbeddingGenerationOptionsEncodingFormat(Base64Value); - public static bool operator ==(InternalEmbeddingGenerationOptionsEncodingFormat left, InternalEmbeddingGenerationOptionsEncodingFormat right) => left.Equals(right); - public static bool operator !=(InternalEmbeddingGenerationOptionsEncodingFormat left, InternalEmbeddingGenerationOptionsEncodingFormat right) => !left.Equals(right); - public static implicit operator InternalEmbeddingGenerationOptionsEncodingFormat(string value) => new InternalEmbeddingGenerationOptionsEncodingFormat(value); - - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is InternalEmbeddingGenerationOptionsEncodingFormat other && Equals(other); - public bool Equals(InternalEmbeddingGenerationOptionsEncodingFormat other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; - public override string ToString() => _value; - } -} diff --git a/src/Generated/Models/InternalFineTuneChatCompletionRequestAssistantMessage.Serialization.cs b/src/Generated/Models/InternalFineTuneChatCompletionRequestAssistantMessage.Serialization.cs index bfedc16a5..b694ee2d1 100644 --- a/src/Generated/Models/InternalFineTuneChatCompletionRequestAssistantMessage.Serialization.cs +++ b/src/Generated/Models/InternalFineTuneChatCompletionRequestAssistantMessage.Serialization.cs @@ -54,7 +54,7 @@ void IJsonModel.Write(Utf if (Optional.IsCollectionDefined(Content)) { writer.WritePropertyName("content"u8); - SerializeContentValue(writer); + SerializeContentValue(writer, options); } if (true && _serializedAdditionalRawData != null) { diff --git a/src/Generated/Models/InternalFineTuningJob.Serialization.cs b/src/Generated/Models/InternalFineTuningJob.Serialization.cs index fef0a0de5..71e4bb5d9 100644 --- a/src/Generated/Models/InternalFineTuningJob.Serialization.cs +++ b/src/Generated/Models/InternalFineTuningJob.Serialization.cs @@ -46,7 +46,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderW if (FinishedAt != null) { writer.WritePropertyName("finished_at"u8); - writer.WriteStringValue(FinishedAt.Value, "O"); + writer.WriteNumberValue(FinishedAt.Value, "U"); } else { @@ -113,7 +113,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderW if (EstimatedFinish != null) { writer.WritePropertyName("estimated_finish"u8); - writer.WriteStringValue(EstimatedFinish.Value, "O"); + writer.WriteNumberValue(EstimatedFinish.Value, "U"); } else { @@ -216,7 +216,7 @@ internal static InternalFineTuningJob DeserializeInternalFineTuningJob(JsonEleme finishedAt = null; continue; } - finishedAt = property.Value.GetDateTimeOffset("O"); + finishedAt = DateTimeOffset.FromUnixTimeSeconds(property.Value.GetInt64()); continue; } if (property.NameEquals("hyperparameters"u8)) @@ -305,7 +305,7 @@ internal static InternalFineTuningJob DeserializeInternalFineTuningJob(JsonEleme estimatedFinish = null; continue; } - estimatedFinish = property.Value.GetDateTimeOffset("O"); + estimatedFinish = DateTimeOffset.FromUnixTimeSeconds(property.Value.GetInt64()); continue; } if (true) diff --git a/src/Generated/Models/InternalFinetuneChatRequestInput.Serialization.cs b/src/Generated/Models/InternalFinetuneChatRequestInput.Serialization.cs index 92ef9067f..8d0d2e2ec 100644 --- a/src/Generated/Models/InternalFinetuneChatRequestInput.Serialization.cs +++ b/src/Generated/Models/InternalFinetuneChatRequestInput.Serialization.cs @@ -107,10 +107,10 @@ internal static InternalFinetuneChatRequestInput DeserializeInternalFinetuneChat { return null; } - IReadOnlyList messages = default; - IReadOnlyList tools = default; + IList messages = default; + IList tools = default; bool? parallelToolCalls = default; - IReadOnlyList functions = default; + IList functions = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) diff --git a/src/Generated/Models/InternalFinetuneChatRequestInput.cs b/src/Generated/Models/InternalFinetuneChatRequestInput.cs index ad1c6ca85..83bcf7f59 100644 --- a/src/Generated/Models/InternalFinetuneChatRequestInput.cs +++ b/src/Generated/Models/InternalFinetuneChatRequestInput.cs @@ -12,14 +12,14 @@ internal partial class InternalFinetuneChatRequestInput { internal IDictionary _serializedAdditionalRawData; - internal InternalFinetuneChatRequestInput() + public InternalFinetuneChatRequestInput() { Messages = new ChangeTrackingList(); Tools = new ChangeTrackingList(); Functions = new ChangeTrackingList(); } - internal InternalFinetuneChatRequestInput(IReadOnlyList messages, IReadOnlyList tools, bool? parallelToolCalls, IReadOnlyList functions, IDictionary serializedAdditionalRawData) + internal InternalFinetuneChatRequestInput(IList messages, IList tools, bool? parallelToolCalls, IList functions, IDictionary serializedAdditionalRawData) { Messages = messages; Tools = tools; @@ -28,9 +28,9 @@ internal InternalFinetuneChatRequestInput(IReadOnlyList messages, IR _serializedAdditionalRawData = serializedAdditionalRawData; } - public IReadOnlyList Messages { get; } - public IReadOnlyList Tools { get; } - public bool? ParallelToolCalls { get; } - public IReadOnlyList Functions { get; } + public IList Messages { get; } + public IList Tools { get; } + public bool? ParallelToolCalls { get; set; } + public IList Functions { get; } } } diff --git a/src/Generated/Models/InternalFinetuneCompletionRequestInput.cs b/src/Generated/Models/InternalFinetuneCompletionRequestInput.cs index eb098306b..cd5ae8223 100644 --- a/src/Generated/Models/InternalFinetuneCompletionRequestInput.cs +++ b/src/Generated/Models/InternalFinetuneCompletionRequestInput.cs @@ -11,7 +11,7 @@ internal partial class InternalFinetuneCompletionRequestInput { internal IDictionary _serializedAdditionalRawData; - internal InternalFinetuneCompletionRequestInput() + public InternalFinetuneCompletionRequestInput() { } @@ -22,7 +22,7 @@ internal InternalFinetuneCompletionRequestInput(string prompt, string completion _serializedAdditionalRawData = serializedAdditionalRawData; } - public string Prompt { get; } - public string Completion { get; } + public string Prompt { get; set; } + public string Completion { get; set; } } } diff --git a/src/Generated/Models/InternalImageEditOptionsResponseFormat.cs b/src/Generated/Models/InternalImageEditOptionsResponseFormat.cs deleted file mode 100644 index b91eee265..000000000 --- a/src/Generated/Models/InternalImageEditOptionsResponseFormat.cs +++ /dev/null @@ -1,36 +0,0 @@ -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace OpenAI.Images -{ - internal readonly partial struct InternalImageEditOptionsResponseFormat : IEquatable - { - private readonly string _value; - - public InternalImageEditOptionsResponseFormat(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string UrlValue = "url"; - private const string B64JsonValue = "b64_json"; - - public static InternalImageEditOptionsResponseFormat Url { get; } = new InternalImageEditOptionsResponseFormat(UrlValue); - public static InternalImageEditOptionsResponseFormat B64Json { get; } = new InternalImageEditOptionsResponseFormat(B64JsonValue); - public static bool operator ==(InternalImageEditOptionsResponseFormat left, InternalImageEditOptionsResponseFormat right) => left.Equals(right); - public static bool operator !=(InternalImageEditOptionsResponseFormat left, InternalImageEditOptionsResponseFormat right) => !left.Equals(right); - public static implicit operator InternalImageEditOptionsResponseFormat(string value) => new InternalImageEditOptionsResponseFormat(value); - - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is InternalImageEditOptionsResponseFormat other && Equals(other); - public bool Equals(InternalImageEditOptionsResponseFormat other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; - public override string ToString() => _value; - } -} diff --git a/src/Generated/Models/InternalImageEditOptionsSize.cs b/src/Generated/Models/InternalImageEditOptionsSize.cs deleted file mode 100644 index ceff19083..000000000 --- a/src/Generated/Models/InternalImageEditOptionsSize.cs +++ /dev/null @@ -1,38 +0,0 @@ -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace OpenAI.Images -{ - internal readonly partial struct InternalImageEditOptionsSize : IEquatable - { - private readonly string _value; - - public InternalImageEditOptionsSize(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string _256x256Value = "256x256"; - private const string _512x512Value = "512x512"; - private const string _1024x1024Value = "1024x1024"; - - public static InternalImageEditOptionsSize _256x256 { get; } = new InternalImageEditOptionsSize(_256x256Value); - public static InternalImageEditOptionsSize _512x512 { get; } = new InternalImageEditOptionsSize(_512x512Value); - public static InternalImageEditOptionsSize _1024x1024 { get; } = new InternalImageEditOptionsSize(_1024x1024Value); - public static bool operator ==(InternalImageEditOptionsSize left, InternalImageEditOptionsSize right) => left.Equals(right); - public static bool operator !=(InternalImageEditOptionsSize left, InternalImageEditOptionsSize right) => !left.Equals(right); - public static implicit operator InternalImageEditOptionsSize(string value) => new InternalImageEditOptionsSize(value); - - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is InternalImageEditOptionsSize other && Equals(other); - public bool Equals(InternalImageEditOptionsSize other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; - public override string ToString() => _value; - } -} diff --git a/src/Generated/Models/InternalImageVariationOptionsResponseFormat.cs b/src/Generated/Models/InternalImageVariationOptionsResponseFormat.cs deleted file mode 100644 index e6a296210..000000000 --- a/src/Generated/Models/InternalImageVariationOptionsResponseFormat.cs +++ /dev/null @@ -1,36 +0,0 @@ -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace OpenAI.Images -{ - internal readonly partial struct InternalImageVariationOptionsResponseFormat : IEquatable - { - private readonly string _value; - - public InternalImageVariationOptionsResponseFormat(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string UrlValue = "url"; - private const string B64JsonValue = "b64_json"; - - public static InternalImageVariationOptionsResponseFormat Url { get; } = new InternalImageVariationOptionsResponseFormat(UrlValue); - public static InternalImageVariationOptionsResponseFormat B64Json { get; } = new InternalImageVariationOptionsResponseFormat(B64JsonValue); - public static bool operator ==(InternalImageVariationOptionsResponseFormat left, InternalImageVariationOptionsResponseFormat right) => left.Equals(right); - public static bool operator !=(InternalImageVariationOptionsResponseFormat left, InternalImageVariationOptionsResponseFormat right) => !left.Equals(right); - public static implicit operator InternalImageVariationOptionsResponseFormat(string value) => new InternalImageVariationOptionsResponseFormat(value); - - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is InternalImageVariationOptionsResponseFormat other && Equals(other); - public bool Equals(InternalImageVariationOptionsResponseFormat other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; - public override string ToString() => _value; - } -} diff --git a/src/Generated/Models/InternalImageVariationOptionsSize.cs b/src/Generated/Models/InternalImageVariationOptionsSize.cs deleted file mode 100644 index bd8e08461..000000000 --- a/src/Generated/Models/InternalImageVariationOptionsSize.cs +++ /dev/null @@ -1,38 +0,0 @@ -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace OpenAI.Images -{ - internal readonly partial struct InternalImageVariationOptionsSize : IEquatable - { - private readonly string _value; - - public InternalImageVariationOptionsSize(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string _256x256Value = "256x256"; - private const string _512x512Value = "512x512"; - private const string _1024x1024Value = "1024x1024"; - - public static InternalImageVariationOptionsSize _256x256 { get; } = new InternalImageVariationOptionsSize(_256x256Value); - public static InternalImageVariationOptionsSize _512x512 { get; } = new InternalImageVariationOptionsSize(_512x512Value); - public static InternalImageVariationOptionsSize _1024x1024 { get; } = new InternalImageVariationOptionsSize(_1024x1024Value); - public static bool operator ==(InternalImageVariationOptionsSize left, InternalImageVariationOptionsSize right) => left.Equals(right); - public static bool operator !=(InternalImageVariationOptionsSize left, InternalImageVariationOptionsSize right) => !left.Equals(right); - public static implicit operator InternalImageVariationOptionsSize(string value) => new InternalImageVariationOptionsSize(value); - - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is InternalImageVariationOptionsSize other && Equals(other); - public bool Equals(InternalImageVariationOptionsSize other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; - public override string ToString() => _value; - } -} diff --git a/src/Generated/Models/InternalListThreadsResponse.Serialization.cs b/src/Generated/Models/InternalListThreadsResponse.Serialization.cs index 6366efd86..324cddd77 100644 --- a/src/Generated/Models/InternalListThreadsResponse.Serialization.cs +++ b/src/Generated/Models/InternalListThreadsResponse.Serialization.cs @@ -22,7 +22,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelR writer.WriteStartObject(); writer.WritePropertyName("object"u8); - writer.WriteStringValue(Object); + writer.WriteStringValue(Object.ToString()); writer.WritePropertyName("data"u8); writer.WriteStartArray(); foreach (var item in Data) @@ -74,7 +74,7 @@ internal static InternalListThreadsResponse DeserializeInternalListThreadsRespon { return null; } - string @object = default; + InternalListThreadsResponseObject @object = default; IReadOnlyList data = default; string firstId = default; string lastId = default; @@ -85,7 +85,7 @@ internal static InternalListThreadsResponse DeserializeInternalListThreadsRespon { if (property.NameEquals("object"u8)) { - @object = property.Value.GetString(); + @object = new InternalListThreadsResponseObject(property.Value.GetString()); continue; } if (property.NameEquals("data"u8)) diff --git a/src/Generated/Models/InternalListThreadsResponse.cs b/src/Generated/Models/InternalListThreadsResponse.cs index 64f561ba6..8714a1c72 100644 --- a/src/Generated/Models/InternalListThreadsResponse.cs +++ b/src/Generated/Models/InternalListThreadsResponse.cs @@ -24,7 +24,7 @@ internal InternalListThreadsResponse(IEnumerable data, string f HasMore = hasMore; } - internal InternalListThreadsResponse(string @object, IReadOnlyList data, string firstId, string lastId, bool hasMore, IDictionary serializedAdditionalRawData) + internal InternalListThreadsResponse(InternalListThreadsResponseObject @object, IReadOnlyList data, string firstId, string lastId, bool hasMore, IDictionary serializedAdditionalRawData) { Object = @object; Data = data; @@ -38,7 +38,7 @@ internal InternalListThreadsResponse() { } - public string Object { get; } = "list"; + public InternalListThreadsResponseObject Object { get; } = InternalListThreadsResponseObject.List; public IReadOnlyList Data { get; } public string FirstId { get; } diff --git a/src/Generated/Models/InternalMessageContentImageFileObjectImageFileDetail.cs b/src/Generated/Models/InternalMessageContentImageFileObjectImageFileDetail.cs new file mode 100644 index 000000000..76d57f5b5 --- /dev/null +++ b/src/Generated/Models/InternalMessageContentImageFileObjectImageFileDetail.cs @@ -0,0 +1,38 @@ +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace OpenAI.Assistants +{ + internal readonly partial struct InternalMessageContentImageFileObjectImageFileDetail : IEquatable + { + private readonly string _value; + + public InternalMessageContentImageFileObjectImageFileDetail(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AutoValue = "auto"; + private const string LowValue = "low"; + private const string HighValue = "high"; + + public static InternalMessageContentImageFileObjectImageFileDetail Auto { get; } = new InternalMessageContentImageFileObjectImageFileDetail(AutoValue); + public static InternalMessageContentImageFileObjectImageFileDetail Low { get; } = new InternalMessageContentImageFileObjectImageFileDetail(LowValue); + public static InternalMessageContentImageFileObjectImageFileDetail High { get; } = new InternalMessageContentImageFileObjectImageFileDetail(HighValue); + public static bool operator ==(InternalMessageContentImageFileObjectImageFileDetail left, InternalMessageContentImageFileObjectImageFileDetail right) => left.Equals(right); + public static bool operator !=(InternalMessageContentImageFileObjectImageFileDetail left, InternalMessageContentImageFileObjectImageFileDetail right) => !left.Equals(right); + public static implicit operator InternalMessageContentImageFileObjectImageFileDetail(string value) => new InternalMessageContentImageFileObjectImageFileDetail(value); + + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is InternalMessageContentImageFileObjectImageFileDetail other && Equals(other); + public bool Equals(InternalMessageContentImageFileObjectImageFileDetail other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + public override string ToString() => _value; + } +} diff --git a/src/Generated/Models/InternalMessageContentItemFileObjectImageFileDetail.cs b/src/Generated/Models/InternalMessageContentItemFileObjectImageFileDetail.cs deleted file mode 100644 index 856847be3..000000000 --- a/src/Generated/Models/InternalMessageContentItemFileObjectImageFileDetail.cs +++ /dev/null @@ -1,38 +0,0 @@ -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace OpenAI.Assistants -{ - internal readonly partial struct InternalMessageContentItemFileObjectImageFileDetail : IEquatable - { - private readonly string _value; - - public InternalMessageContentItemFileObjectImageFileDetail(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string AutoValue = "auto"; - private const string LowValue = "low"; - private const string HighValue = "high"; - - public static InternalMessageContentItemFileObjectImageFileDetail Auto { get; } = new InternalMessageContentItemFileObjectImageFileDetail(AutoValue); - public static InternalMessageContentItemFileObjectImageFileDetail Low { get; } = new InternalMessageContentItemFileObjectImageFileDetail(LowValue); - public static InternalMessageContentItemFileObjectImageFileDetail High { get; } = new InternalMessageContentItemFileObjectImageFileDetail(HighValue); - public static bool operator ==(InternalMessageContentItemFileObjectImageFileDetail left, InternalMessageContentItemFileObjectImageFileDetail right) => left.Equals(right); - public static bool operator !=(InternalMessageContentItemFileObjectImageFileDetail left, InternalMessageContentItemFileObjectImageFileDetail right) => !left.Equals(right); - public static implicit operator InternalMessageContentItemFileObjectImageFileDetail(string value) => new InternalMessageContentItemFileObjectImageFileDetail(value); - - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is InternalMessageContentItemFileObjectImageFileDetail other && Equals(other); - public bool Equals(InternalMessageContentItemFileObjectImageFileDetail other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; - public override string ToString() => _value; - } -} diff --git a/src/Generated/Models/InternalMessageDeltaObject.Serialization.cs b/src/Generated/Models/InternalMessageDeltaObject.Serialization.cs index e2f95a5f8..315470eb3 100644 --- a/src/Generated/Models/InternalMessageDeltaObject.Serialization.cs +++ b/src/Generated/Models/InternalMessageDeltaObject.Serialization.cs @@ -24,7 +24,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRe writer.WritePropertyName("id"u8); writer.WriteStringValue(Id); writer.WritePropertyName("object"u8); - writer.WriteStringValue(Object); + writer.WriteStringValue(Object.ToString()); writer.WritePropertyName("delta"u8); writer.WriteObjectValue(Delta, options); if (true && _serializedAdditionalRawData != null) @@ -66,7 +66,7 @@ internal static InternalMessageDeltaObject DeserializeInternalMessageDeltaObject return null; } string id = default; - string @object = default; + InternalMessageDeltaObjectObject @object = default; MessageDeltaObjectDelta delta = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); @@ -79,7 +79,7 @@ internal static InternalMessageDeltaObject DeserializeInternalMessageDeltaObject } if (property.NameEquals("object"u8)) { - @object = property.Value.GetString(); + @object = new InternalMessageDeltaObjectObject(property.Value.GetString()); continue; } if (property.NameEquals("delta"u8)) diff --git a/src/Generated/Models/InternalMessageDeltaObject.cs b/src/Generated/Models/InternalMessageDeltaObject.cs index 3f4fc21b0..e821e829f 100644 --- a/src/Generated/Models/InternalMessageDeltaObject.cs +++ b/src/Generated/Models/InternalMessageDeltaObject.cs @@ -20,7 +20,7 @@ internal InternalMessageDeltaObject(string id, MessageDeltaObjectDelta delta) Delta = delta; } - internal InternalMessageDeltaObject(string id, string @object, MessageDeltaObjectDelta delta, IDictionary serializedAdditionalRawData) + internal InternalMessageDeltaObject(string id, InternalMessageDeltaObjectObject @object, MessageDeltaObjectDelta delta, IDictionary serializedAdditionalRawData) { Id = id; Object = @object; @@ -33,7 +33,7 @@ internal InternalMessageDeltaObject() } public string Id { get; } - public string Object { get; } = "thread.message.delta"; + public InternalMessageDeltaObjectObject Object { get; } = InternalMessageDeltaObjectObject.ThreadMessageDelta; public MessageDeltaObjectDelta Delta { get; } } diff --git a/src/Generated/Models/InternalMessageObjectRole.cs b/src/Generated/Models/InternalMessageObjectRole.cs new file mode 100644 index 000000000..2b04a1f32 --- /dev/null +++ b/src/Generated/Models/InternalMessageObjectRole.cs @@ -0,0 +1,36 @@ +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace OpenAI.Assistants +{ + internal readonly partial struct InternalMessageObjectRole : IEquatable + { + private readonly string _value; + + public InternalMessageObjectRole(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UserValue = "user"; + private const string AssistantValue = "assistant"; + + public static InternalMessageObjectRole User { get; } = new InternalMessageObjectRole(UserValue); + public static InternalMessageObjectRole Assistant { get; } = new InternalMessageObjectRole(AssistantValue); + public static bool operator ==(InternalMessageObjectRole left, InternalMessageObjectRole right) => left.Equals(right); + public static bool operator !=(InternalMessageObjectRole left, InternalMessageObjectRole right) => !left.Equals(right); + public static implicit operator InternalMessageObjectRole(string value) => new InternalMessageObjectRole(value); + + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is InternalMessageObjectRole other && Equals(other); + public bool Equals(InternalMessageObjectRole other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + public override string ToString() => _value; + } +} diff --git a/src/Generated/Models/InternalRunTruncationStrategyType.cs b/src/Generated/Models/InternalRunTruncationStrategyType.cs deleted file mode 100644 index 064dc8a4b..000000000 --- a/src/Generated/Models/InternalRunTruncationStrategyType.cs +++ /dev/null @@ -1,36 +0,0 @@ -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace OpenAI.Assistants -{ - internal readonly partial struct InternalRunTruncationStrategyType : IEquatable - { - private readonly string _value; - - public InternalRunTruncationStrategyType(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string AutoValue = "auto"; - private const string LastMessagesValue = "last_messages"; - - public static InternalRunTruncationStrategyType Auto { get; } = new InternalRunTruncationStrategyType(AutoValue); - public static InternalRunTruncationStrategyType LastMessages { get; } = new InternalRunTruncationStrategyType(LastMessagesValue); - public static bool operator ==(InternalRunTruncationStrategyType left, InternalRunTruncationStrategyType right) => left.Equals(right); - public static bool operator !=(InternalRunTruncationStrategyType left, InternalRunTruncationStrategyType right) => !left.Equals(right); - public static implicit operator InternalRunTruncationStrategyType(string value) => new InternalRunTruncationStrategyType(value); - - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is InternalRunTruncationStrategyType other && Equals(other); - public bool Equals(InternalRunTruncationStrategyType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; - public override string ToString() => _value; - } -} diff --git a/src/Generated/Models/InternalThreadMessageRole.cs b/src/Generated/Models/InternalThreadMessageRole.cs deleted file mode 100644 index 958977d63..000000000 --- a/src/Generated/Models/InternalThreadMessageRole.cs +++ /dev/null @@ -1,36 +0,0 @@ -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace OpenAI.Assistants -{ - internal readonly partial struct InternalThreadMessageRole : IEquatable - { - private readonly string _value; - - public InternalThreadMessageRole(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string UserValue = "user"; - private const string AssistantValue = "assistant"; - - public static InternalThreadMessageRole User { get; } = new InternalThreadMessageRole(UserValue); - public static InternalThreadMessageRole Assistant { get; } = new InternalThreadMessageRole(AssistantValue); - public static bool operator ==(InternalThreadMessageRole left, InternalThreadMessageRole right) => left.Equals(right); - public static bool operator !=(InternalThreadMessageRole left, InternalThreadMessageRole right) => !left.Equals(right); - public static implicit operator InternalThreadMessageRole(string value) => new InternalThreadMessageRole(value); - - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is InternalThreadMessageRole other && Equals(other); - public bool Equals(InternalThreadMessageRole other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; - public override string ToString() => _value; - } -} diff --git a/src/Generated/Models/InternalToolConstraintType.cs b/src/Generated/Models/InternalToolConstraintType.cs deleted file mode 100644 index 62421b142..000000000 --- a/src/Generated/Models/InternalToolConstraintType.cs +++ /dev/null @@ -1,38 +0,0 @@ -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace OpenAI.Assistants -{ - internal readonly partial struct InternalToolConstraintType : IEquatable - { - private readonly string _value; - - public InternalToolConstraintType(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string FunctionValue = "function"; - private const string CodeInterpreterValue = "code_interpreter"; - private const string FileSearchValue = "file_search"; - - public static InternalToolConstraintType Function { get; } = new InternalToolConstraintType(FunctionValue); - public static InternalToolConstraintType CodeInterpreter { get; } = new InternalToolConstraintType(CodeInterpreterValue); - public static InternalToolConstraintType FileSearch { get; } = new InternalToolConstraintType(FileSearchValue); - public static bool operator ==(InternalToolConstraintType left, InternalToolConstraintType right) => left.Equals(right); - public static bool operator !=(InternalToolConstraintType left, InternalToolConstraintType right) => !left.Equals(right); - public static implicit operator InternalToolConstraintType(string value) => new InternalToolConstraintType(value); - - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is InternalToolConstraintType other && Equals(other); - public bool Equals(InternalToolConstraintType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; - public override string ToString() => _value; - } -} diff --git a/src/Generated/Models/InternalTruncationObjectType.cs b/src/Generated/Models/InternalTruncationObjectType.cs new file mode 100644 index 000000000..4fda17bcc --- /dev/null +++ b/src/Generated/Models/InternalTruncationObjectType.cs @@ -0,0 +1,36 @@ +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace OpenAI.Assistants +{ + internal readonly partial struct InternalTruncationObjectType : IEquatable + { + private readonly string _value; + + public InternalTruncationObjectType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AutoValue = "auto"; + private const string LastMessagesValue = "last_messages"; + + public static InternalTruncationObjectType Auto { get; } = new InternalTruncationObjectType(AutoValue); + public static InternalTruncationObjectType LastMessages { get; } = new InternalTruncationObjectType(LastMessagesValue); + public static bool operator ==(InternalTruncationObjectType left, InternalTruncationObjectType right) => left.Equals(right); + public static bool operator !=(InternalTruncationObjectType left, InternalTruncationObjectType right) => !left.Equals(right); + public static implicit operator InternalTruncationObjectType(string value) => new InternalTruncationObjectType(value); + + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is InternalTruncationObjectType other && Equals(other); + public bool Equals(InternalTruncationObjectType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + public override string ToString() => _value; + } +} diff --git a/src/Generated/Models/MessageCreationAttachment.Serialization.cs b/src/Generated/Models/MessageCreationAttachment.Serialization.cs index c4347a1b9..ac0167def 100644 --- a/src/Generated/Models/MessageCreationAttachment.Serialization.cs +++ b/src/Generated/Models/MessageCreationAttachment.Serialization.cs @@ -24,7 +24,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRea writer.WritePropertyName("file_id"u8); writer.WriteStringValue(FileId); writer.WritePropertyName("tools"u8); - SerializeTools(writer); + SerializeTools(writer, options); if (true && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) diff --git a/src/Generated/Models/MessageCreationOptions.Serialization.cs b/src/Generated/Models/MessageCreationOptions.Serialization.cs index c4f2ad697..f4baa938e 100644 --- a/src/Generated/Models/MessageCreationOptions.Serialization.cs +++ b/src/Generated/Models/MessageCreationOptions.Serialization.cs @@ -24,7 +24,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReader writer.WritePropertyName("role"u8); writer.WriteStringValue(Role.ToSerialString()); writer.WritePropertyName("content"u8); - SerializeContent(writer); + SerializeContent(writer, options); if (Optional.IsCollectionDefined(Attachments)) { if (Attachments != null) diff --git a/src/Generated/Models/RunCreationOptions.Serialization.cs b/src/Generated/Models/RunCreationOptions.Serialization.cs index 906ca5c80..4e9be1a49 100644 --- a/src/Generated/Models/RunCreationOptions.Serialization.cs +++ b/src/Generated/Models/RunCreationOptions.Serialization.cs @@ -183,12 +183,13 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWrit writer.WriteNull("truncation_strategy"); } } + // CUSTOM: Made nullable. if (Optional.IsDefined(ToolConstraint)) { if (ToolConstraint != null) { writer.WritePropertyName("tool_choice"u8); - SerializeToolConstraint(writer); + SerializeToolConstraint(writer, options); } else { @@ -200,6 +201,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("parallel_tool_calls"u8); writer.WriteBooleanValue(ParallelToolCallsEnabled.Value); } + // CUSTOM: Made nullable. if (Optional.IsDefined(ResponseFormat)) { if (ResponseFormat != null) @@ -407,6 +409,7 @@ internal static RunCreationOptions DeserializeRunCreationOptions(JsonElement ele truncationStrategy = RunTruncationStrategy.DeserializeRunTruncationStrategy(property.Value, options); continue; } + // CUSTOM: Made nullable. if (property.NameEquals("tool_choice"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -426,6 +429,7 @@ internal static RunCreationOptions DeserializeRunCreationOptions(JsonElement ele parallelToolCalls = property.Value.GetBoolean(); continue; } + // CUSTOM: Made nullable. if (property.NameEquals("response_format"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) diff --git a/src/Generated/Models/RunStep.Serialization.cs b/src/Generated/Models/RunStep.Serialization.cs index 5ee14a0ef..9aff37f59 100644 --- a/src/Generated/Models/RunStep.Serialization.cs +++ b/src/Generated/Models/RunStep.Serialization.cs @@ -51,7 +51,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions o if (ExpiredAt != null) { writer.WritePropertyName("expired_at"u8); - writer.WriteStringValue(ExpiredAt.Value, "O"); + writer.WriteNumberValue(ExpiredAt.Value, "U"); } else { @@ -60,7 +60,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions o if (CancelledAt != null) { writer.WritePropertyName("cancelled_at"u8); - writer.WriteStringValue(CancelledAt.Value, "O"); + writer.WriteNumberValue(CancelledAt.Value, "U"); } else { @@ -69,7 +69,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions o if (FailedAt != null) { writer.WritePropertyName("failed_at"u8); - writer.WriteStringValue(FailedAt.Value, "O"); + writer.WriteNumberValue(FailedAt.Value, "U"); } else { @@ -78,7 +78,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions o if (CompletedAt != null) { writer.WritePropertyName("completed_at"u8); - writer.WriteStringValue(CompletedAt.Value, "O"); + writer.WriteNumberValue(CompletedAt.Value, "U"); } else { @@ -228,7 +228,7 @@ internal static RunStep DeserializeRunStep(JsonElement element, ModelReaderWrite expiredAt = null; continue; } - expiredAt = property.Value.GetDateTimeOffset("O"); + expiredAt = DateTimeOffset.FromUnixTimeSeconds(property.Value.GetInt64()); continue; } if (property.NameEquals("cancelled_at"u8)) @@ -238,8 +238,6 @@ internal static RunStep DeserializeRunStep(JsonElement element, ModelReaderWrite cancelledAt = null; continue; } - // BUG: https://github.com/Azure/autorest.csharp/issues/4296 - // cancelledAt = property.Value.GetDateTimeOffset("O"); cancelledAt = DateTimeOffset.FromUnixTimeSeconds(property.Value.GetInt64()); continue; } @@ -250,8 +248,6 @@ internal static RunStep DeserializeRunStep(JsonElement element, ModelReaderWrite failedAt = null; continue; } - // BUG: https://github.com/Azure/autorest.csharp/issues/4296 - // failedAt = property.Value.GetDateTimeOffset("O"); failedAt = DateTimeOffset.FromUnixTimeSeconds(property.Value.GetInt64()); continue; } @@ -262,8 +258,6 @@ internal static RunStep DeserializeRunStep(JsonElement element, ModelReaderWrite completedAt = null; continue; } - // BUG: https://github.com/Azure/autorest.csharp/issues/4296 - // completedAt = property.Value.GetDateTimeOffset("O"); completedAt = DateTimeOffset.FromUnixTimeSeconds(property.Value.GetInt64()); continue; } diff --git a/src/Generated/Models/RunTruncationStrategy.Serialization.cs b/src/Generated/Models/RunTruncationStrategy.Serialization.cs index 729980b76..e19170a39 100644 --- a/src/Generated/Models/RunTruncationStrategy.Serialization.cs +++ b/src/Generated/Models/RunTruncationStrategy.Serialization.cs @@ -73,7 +73,7 @@ internal static RunTruncationStrategy DeserializeRunTruncationStrategy(JsonEleme { return null; } - InternalRunTruncationStrategyType type = default; + InternalTruncationObjectType type = default; int? lastMessages = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); @@ -81,7 +81,7 @@ internal static RunTruncationStrategy DeserializeRunTruncationStrategy(JsonEleme { if (property.NameEquals("type"u8)) { - type = new InternalRunTruncationStrategyType(property.Value.GetString()); + type = new InternalTruncationObjectType(property.Value.GetString()); continue; } if (property.NameEquals("last_messages"u8)) diff --git a/src/Generated/Models/RunTruncationStrategy.cs b/src/Generated/Models/RunTruncationStrategy.cs index bd9f861d1..f1c011b39 100644 --- a/src/Generated/Models/RunTruncationStrategy.cs +++ b/src/Generated/Models/RunTruncationStrategy.cs @@ -9,7 +9,7 @@ namespace OpenAI.Assistants { public partial class RunTruncationStrategy { - internal RunTruncationStrategy(InternalRunTruncationStrategyType type, int? lastMessages, IDictionary serializedAdditionalRawData) + internal RunTruncationStrategy(InternalTruncationObjectType type, int? lastMessages, IDictionary serializedAdditionalRawData) { _type = type; LastMessages = lastMessages; diff --git a/src/Generated/Models/ThreadMessage.Serialization.cs b/src/Generated/Models/ThreadMessage.Serialization.cs index 83d253416..25d6ccdc5 100644 --- a/src/Generated/Models/ThreadMessage.Serialization.cs +++ b/src/Generated/Models/ThreadMessage.Serialization.cs @@ -43,7 +43,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOpt if (CompletedAt != null) { writer.WritePropertyName("completed_at"u8); - writer.WriteStringValue(CompletedAt.Value, "O"); + writer.WriteNumberValue(CompletedAt.Value, "U"); } else { @@ -52,7 +52,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOpt if (IncompleteAt != null) { writer.WritePropertyName("incomplete_at"u8); - writer.WriteStringValue(IncompleteAt.Value, "O"); + writer.WriteNumberValue(IncompleteAt.Value, "U"); } else { @@ -212,8 +212,6 @@ internal static ThreadMessage DeserializeThreadMessage(JsonElement element, Mode completedAt = null; continue; } - // BUG: https://github.com/Azure/autorest.csharp/issues/4296 - // completedAt = property.Value.GetDateTimeOffset("O"); completedAt = DateTimeOffset.FromUnixTimeSeconds(property.Value.GetInt64()); continue; } @@ -224,7 +222,7 @@ internal static ThreadMessage DeserializeThreadMessage(JsonElement element, Mode incompleteAt = null; continue; } - incompleteAt = property.Value.GetDateTimeOffset("O"); + incompleteAt = DateTimeOffset.FromUnixTimeSeconds(property.Value.GetInt64()); continue; } if (property.NameEquals("role"u8)) diff --git a/src/Generated/Models/ThreadRun.Serialization.cs b/src/Generated/Models/ThreadRun.Serialization.cs index bbcfff949..d099efbc6 100644 --- a/src/Generated/Models/ThreadRun.Serialization.cs +++ b/src/Generated/Models/ThreadRun.Serialization.cs @@ -54,7 +54,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions if (ExpiresAt != null) { writer.WritePropertyName("expires_at"u8); - writer.WriteStringValue(ExpiresAt.Value, "O"); + writer.WriteNumberValue(ExpiresAt.Value, "U"); } else { @@ -63,7 +63,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions if (StartedAt != null) { writer.WritePropertyName("started_at"u8); - writer.WriteStringValue(StartedAt.Value, "O"); + writer.WriteNumberValue(StartedAt.Value, "U"); } else { @@ -72,7 +72,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions if (CancelledAt != null) { writer.WritePropertyName("cancelled_at"u8); - writer.WriteStringValue(CancelledAt.Value, "O"); + writer.WriteNumberValue(CancelledAt.Value, "U"); } else { @@ -81,7 +81,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions if (FailedAt != null) { writer.WritePropertyName("failed_at"u8); - writer.WriteStringValue(FailedAt.Value, "O"); + writer.WriteNumberValue(FailedAt.Value, "U"); } else { @@ -90,7 +90,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions if (CompletedAt != null) { writer.WritePropertyName("completed_at"u8); - writer.WriteStringValue(CompletedAt.Value, "O"); + writer.WriteNumberValue(CompletedAt.Value, "U"); } else { @@ -191,6 +191,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions { writer.WriteNull("truncation_strategy"); } + // CUSTOM: Made nullable. if (ToolConstraint != null) { writer.WritePropertyName("tool_choice"u8); @@ -202,6 +203,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions } writer.WritePropertyName("parallel_tool_calls"u8); writer.WriteBooleanValue(ParallelToolCallsEnabled.Value); + // CUSTOM: Made nullable. if (ResponseFormat != null) { writer.WritePropertyName("response_format"u8); @@ -337,8 +339,6 @@ internal static ThreadRun DeserializeThreadRun(JsonElement element, ModelReaderW expiresAt = null; continue; } - // BUG: https://github.com/Azure/autorest.csharp/issues/4296 - // expiresAt = property.Value.GetDateTimeOffset("O"); expiresAt = DateTimeOffset.FromUnixTimeSeconds(property.Value.GetInt64()); continue; } @@ -349,8 +349,6 @@ internal static ThreadRun DeserializeThreadRun(JsonElement element, ModelReaderW startedAt = null; continue; } - // BUG: https://github.com/Azure/autorest.csharp/issues/4296 - // startedAt = property.Value.GetDateTimeOffset("O"); startedAt = DateTimeOffset.FromUnixTimeSeconds(property.Value.GetInt64()); continue; } @@ -361,8 +359,6 @@ internal static ThreadRun DeserializeThreadRun(JsonElement element, ModelReaderW cancelledAt = null; continue; } - // BUG: https://github.com/Azure/autorest.csharp/issues/4296 - // cancelledAt = property.Value.GetDateTimeOffset("O"); cancelledAt = DateTimeOffset.FromUnixTimeSeconds(property.Value.GetInt64()); continue; } @@ -373,8 +369,6 @@ internal static ThreadRun DeserializeThreadRun(JsonElement element, ModelReaderW failedAt = null; continue; } - // BUG: https://github.com/Azure/autorest.csharp/issues/4296 - // failedAt = property.Value.GetDateTimeOffset("O"); failedAt = DateTimeOffset.FromUnixTimeSeconds(property.Value.GetInt64()); continue; } @@ -385,8 +379,6 @@ internal static ThreadRun DeserializeThreadRun(JsonElement element, ModelReaderW completedAt = null; continue; } - // BUG: https://github.com/Azure/autorest.csharp/issues/4296 - // completedAt = property.Value.GetDateTimeOffset("O"); completedAt = DateTimeOffset.FromUnixTimeSeconds(property.Value.GetInt64()); continue; } @@ -495,6 +487,7 @@ internal static ThreadRun DeserializeThreadRun(JsonElement element, ModelReaderW truncationStrategy = RunTruncationStrategy.DeserializeRunTruncationStrategy(property.Value, options); continue; } + // CUSTOM: Made nullable. if (property.NameEquals("tool_choice"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -510,6 +503,7 @@ internal static ThreadRun DeserializeThreadRun(JsonElement element, ModelReaderW parallelToolCalls = property.Value.GetBoolean(); continue; } + // CUSTOM: Made nullable. if (property.NameEquals("response_format"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) diff --git a/src/Generated/Models/ThreadRun.cs b/src/Generated/Models/ThreadRun.cs index a4e456f56..3544555f1 100644 --- a/src/Generated/Models/ThreadRun.cs +++ b/src/Generated/Models/ThreadRun.cs @@ -12,41 +12,6 @@ public partial class ThreadRun { internal IDictionary _serializedAdditionalRawData; - internal ThreadRun(string id, DateTimeOffset createdAt, string threadId, string assistantId, RunStatus status, InternalRunRequiredAction internalRequiredAction, RunError lastError, DateTimeOffset? expiresAt, DateTimeOffset? startedAt, DateTimeOffset? cancelledAt, DateTimeOffset? failedAt, DateTimeOffset? completedAt, RunIncompleteDetails incompleteDetails, string model, string instructions, IEnumerable tools, IReadOnlyDictionary metadata, RunTokenUsage usage, int? maxPromptTokens, int? maxCompletionTokens, RunTruncationStrategy truncationStrategy, ToolConstraint toolConstraint, bool? parallelToolCallsEnabled, AssistantResponseFormat responseFormat) - { - Argument.AssertNotNull(id, nameof(id)); - Argument.AssertNotNull(threadId, nameof(threadId)); - Argument.AssertNotNull(assistantId, nameof(assistantId)); - Argument.AssertNotNull(model, nameof(model)); - Argument.AssertNotNull(instructions, nameof(instructions)); - Argument.AssertNotNull(tools, nameof(tools)); - - Id = id; - CreatedAt = createdAt; - ThreadId = threadId; - AssistantId = assistantId; - Status = status; - _internalRequiredAction = internalRequiredAction; - LastError = lastError; - ExpiresAt = expiresAt; - StartedAt = startedAt; - CancelledAt = cancelledAt; - FailedAt = failedAt; - CompletedAt = completedAt; - IncompleteDetails = incompleteDetails; - Model = model; - Instructions = instructions; - Tools = tools.ToList(); - Metadata = metadata; - Usage = usage; - MaxPromptTokens = maxPromptTokens; - MaxCompletionTokens = maxCompletionTokens; - TruncationStrategy = truncationStrategy; - ToolConstraint = toolConstraint; - ParallelToolCallsEnabled = parallelToolCallsEnabled; - ResponseFormat = responseFormat; - } - internal ThreadRun(string id, InternalRunObjectObject @object, DateTimeOffset createdAt, string threadId, string assistantId, RunStatus status, InternalRunRequiredAction internalRequiredAction, RunError lastError, DateTimeOffset? expiresAt, DateTimeOffset? startedAt, DateTimeOffset? cancelledAt, DateTimeOffset? failedAt, DateTimeOffset? completedAt, RunIncompleteDetails incompleteDetails, string model, string instructions, IReadOnlyList tools, IReadOnlyDictionary metadata, RunTokenUsage usage, float? temperature, float? nucleusSamplingFactor, int? maxPromptTokens, int? maxCompletionTokens, RunTruncationStrategy truncationStrategy, ToolConstraint toolConstraint, bool? parallelToolCallsEnabled, AssistantResponseFormat responseFormat, IDictionary serializedAdditionalRawData) { Id = id; diff --git a/src/Generated/Models/ToolResources.Serialization.cs b/src/Generated/Models/ToolResources.Serialization.cs index c48270ba3..57a50c314 100644 --- a/src/Generated/Models/ToolResources.Serialization.cs +++ b/src/Generated/Models/ToolResources.Serialization.cs @@ -29,7 +29,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOpt if (Optional.IsDefined(FileSearch)) { writer.WritePropertyName("file_search"u8); - SerializeFileSearch(writer); + SerializeFileSearch(writer, options); } if (true && _serializedAdditionalRawData != null) { diff --git a/src/Generated/Models/TranscribedSegment.Serialization.cs b/src/Generated/Models/TranscribedSegment.Serialization.cs index 9e43c0ad0..6b010f71a 100644 --- a/src/Generated/Models/TranscribedSegment.Serialization.cs +++ b/src/Generated/Models/TranscribedSegment.Serialization.cs @@ -26,9 +26,9 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("seek"u8); writer.WriteNumberValue(SeekOffset); writer.WritePropertyName("start"u8); - writer.WriteNumberValue(Convert.ToDouble(Start.ToString("s\\.fff"))); + writer.WriteNumberValue(Convert.ToDouble(Start.ToString("s\\.FFF"))); writer.WritePropertyName("end"u8); - writer.WriteNumberValue(Convert.ToDouble(End.ToString("s\\.fff"))); + writer.WriteNumberValue(Convert.ToDouble(End.ToString("s\\.FFF"))); writer.WritePropertyName("text"u8); writer.WriteStringValue(Text); writer.WritePropertyName("tokens"u8); diff --git a/src/Generated/Models/TranscribedWord.Serialization.cs b/src/Generated/Models/TranscribedWord.Serialization.cs index e5b26ceec..7f7855e56 100644 --- a/src/Generated/Models/TranscribedWord.Serialization.cs +++ b/src/Generated/Models/TranscribedWord.Serialization.cs @@ -24,9 +24,9 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterO writer.WritePropertyName("word"u8); writer.WriteStringValue(Word); writer.WritePropertyName("start"u8); - writer.WriteNumberValue(Convert.ToDouble(Start.ToString("s\\.fff"))); + writer.WriteNumberValue(Convert.ToDouble(Start.ToString("s\\.FFF"))); writer.WritePropertyName("end"u8); - writer.WriteNumberValue(Convert.ToDouble(End.ToString("s\\.fff"))); + writer.WriteNumberValue(Convert.ToDouble(End.ToString("s\\.FFF"))); if (true && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) diff --git a/src/Generated/Models/VectorStore.Serialization.cs b/src/Generated/Models/VectorStore.Serialization.cs index 70470fc64..7467a0265 100644 --- a/src/Generated/Models/VectorStore.Serialization.cs +++ b/src/Generated/Models/VectorStore.Serialization.cs @@ -52,7 +52,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptio if (ExpiresAt != null) { writer.WritePropertyName("expires_at"u8); - writer.WriteStringValue(ExpiresAt.Value, "O"); + writer.WriteNumberValue(ExpiresAt.Value, "U"); } else { @@ -62,7 +62,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptio if (LastActiveAt != null) { writer.WritePropertyName("last_active_at"u8); - writer.WriteStringValue(LastActiveAt.Value, "O"); + writer.WriteNumberValue(LastActiveAt.Value, "U"); } else { @@ -188,8 +188,6 @@ internal static VectorStore DeserializeVectorStore(JsonElement element, ModelRea expiresAt = null; continue; } - // BUG: https://github.com/Azure/autorest.csharp/issues/4296 - // expiresAt = property.Value.GetDateTimeOffset("O"); expiresAt = DateTimeOffset.FromUnixTimeSeconds(property.Value.GetInt64()); continue; } @@ -200,8 +198,6 @@ internal static VectorStore DeserializeVectorStore(JsonElement element, ModelRea lastActiveAt = null; continue; } - // BUG: https://github.com/Azure/autorest.csharp/issues/4296 - // lastActiveAt = property.Value.GetDateTimeOffset("O"); lastActiveAt = DateTimeOffset.FromUnixTimeSeconds(property.Value.GetInt64()); continue; } diff --git a/src/OpenAI.csproj b/src/OpenAI.csproj index 8f61f3af6..056929393 100644 --- a/src/OpenAI.csproj +++ b/src/OpenAI.csproj @@ -10,10 +10,6 @@ netstandard2.0;net6.0 latest - - true - OpenAI.snk - true @@ -39,8 +35,23 @@ $(NoWarn),0169 + + Debug;Release;Unsigned + + + + + true + OpenAI.snk + + + 0024000004800000940000000602000000240000525341310004000001000100097ad52abbeaa2e1a1982747cc0106534f65cfea6707eaed696a3a63daea80de2512746801a7e47f88e7781e71af960d89ba2e25561f70b0e2dbc93319e0af1961a719ccf5a4d28709b2b57a5d29b7c09dc8d269a490ebe2651c4b6e6738c27c5fb2c02469fe9757f0a3479ac310d6588a50a28d7dd431b907fd325e18b9e8ed + + + +