diff --git a/CHANGELOG.md b/CHANGELOG.md index 549fc48c9..b3b386383 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,26 @@ # Release History +## 2.5.0 (2025-09-23) + +### Features Added + +- OpenAI.Responses: + - Added the `Model` property to `OpenAIResponseClient`. + - Added the `ServiceDescription` property to `McpTool`. + - Enabled support for connectors, which are OpenAI-maintained MCP wrappers for popular services like Microsoft Outlook or Dropbox. + - Added the `ConnectorId` property to `McpTool`. + - Enabled support for authentication with remote MCP servers. + - Added the `AuthorizationToken` property to `McpTool`. + - Enabled support for the Code Interpreter tool, which allows models to write and run Python code in a sandboxed environment to solve complex problems in domains like data analysis, coding, and math. + - Users can add the new `CodeInterpreterTool` to the `Tools` property of their `ResponseCreationOptions` and configure it. + - Use the `Container` property to configure the sandboxed environment, including any files that should be made available. + +### Bugs Fixed + +- OpenAI.Responses: + - Fixed an issue with the constructor of `McpToolCallApprovalRequestItem` not taking the item ID as a parameter. MCP approval requests are correlated to MCP approval responses using this ID, which implies that this ID should be required. + - Fixed an issue with some of the MCP-related `StreamingResponseUpdate` classes missing the `ItemId` and `OutputIndex` properties. + ## 2.4.0 (2025-09-05) ### Features Added diff --git a/api/OpenAI.net8.0.cs b/api/OpenAI.net8.0.cs index e0125cdcb..166fd7ce3 100644 --- a/api/OpenAI.net8.0.cs +++ b/api/OpenAI.net8.0.cs @@ -4603,27 +4603,52 @@ public class TurnDetectionOptions : IJsonModel, IPersistab } namespace OpenAI.Responses { [Experimental("OPENAI001")] - public class AutomaticCodeInterpreterContainerConfiguration : CodeInterpreterContainerConfiguration, IJsonModel, IPersistableModel { - public AutomaticCodeInterpreterContainerConfiguration(); - public AutomaticCodeInterpreterContainerConfiguration(IEnumerable fileIds = null); + public class AutomaticCodeInterpreterToolContainerConfiguration : CodeInterpreterToolContainerConfiguration, IJsonModel, IPersistableModel { + public AutomaticCodeInterpreterToolContainerConfiguration(); public IList FileIds { get; } - protected override CodeInterpreterContainerConfiguration JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options); + protected override CodeInterpreterToolContainerConfiguration JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options); protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options); - protected override CodeInterpreterContainerConfiguration PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options); + protected override CodeInterpreterToolContainerConfiguration PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options); protected override BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options); } [Experimental("OPENAI001")] + public class CodeInterpreterCallImageOutput : CodeInterpreterCallOutput, IJsonModel, IPersistableModel { + public CodeInterpreterCallImageOutput(Uri imageUri); + public Uri ImageUri { get; set; } + protected override CodeInterpreterCallOutput JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options); + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options); + protected override CodeInterpreterCallOutput PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options); + protected override BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options); + } + [Experimental("OPENAI001")] + public class CodeInterpreterCallLogsOutput : CodeInterpreterCallOutput, IJsonModel, IPersistableModel { + public CodeInterpreterCallLogsOutput(string logs); + public string Logs { get; set; } + protected override CodeInterpreterCallOutput JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options); + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options); + protected override CodeInterpreterCallOutput PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options); + protected override BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options); + } + [Experimental("OPENAI001")] + public class CodeInterpreterCallOutput : IJsonModel, IPersistableModel { + protected virtual CodeInterpreterCallOutput JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options); + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options); + protected virtual CodeInterpreterCallOutput PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options); + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options); + } + [Experimental("OPENAI001")] public class CodeInterpreterCallResponseItem : ResponseItem, IJsonModel, IPersistableModel { public CodeInterpreterCallResponseItem(string code); public string Code { get; set; } public string ContainerId { get; set; } - public IList Outputs { get; } + public IList Outputs { get; } public CodeInterpreterCallStatus? Status { get; } protected override ResponseItem JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options); protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options); protected override ResponseItem PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options); protected override BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options); } + [Experimental("OPENAI001")] public enum CodeInterpreterCallStatus { InProgress = 0, Interpreting = 1, @@ -4632,56 +4657,31 @@ public enum CodeInterpreterCallStatus { Failed = 4 } [Experimental("OPENAI001")] - public class CodeInterpreterContainer : IJsonModel, IPersistableModel { - public CodeInterpreterContainer(CodeInterpreterContainerConfiguration containerConfiguration); - public CodeInterpreterContainer(string containerId); - public CodeInterpreterContainerConfiguration Container { get; set; } - public string ContainerId { get; set; } - protected virtual CodeInterpreterContainer JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options); - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options); - protected virtual CodeInterpreterContainer PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options); - protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options); - } - [Experimental("OPENAI001")] - public class CodeInterpreterContainerConfiguration : IJsonModel, IPersistableModel { - public static AutomaticCodeInterpreterContainerConfiguration CreateAutomaticConfiguration(IEnumerable fileIds = null); - protected virtual CodeInterpreterContainerConfiguration JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options); - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options); - protected virtual CodeInterpreterContainerConfiguration PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options); - protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options); - } - [Experimental("OPENAI001")] public class CodeInterpreterTool : ResponseTool, IJsonModel, IPersistableModel { - public CodeInterpreterTool(CodeInterpreterContainer container); - public CodeInterpreterContainer Container { get; } + public CodeInterpreterTool(CodeInterpreterToolContainer container); + public CodeInterpreterToolContainer Container { get; } protected override ResponseTool JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options); protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options); protected override ResponseTool PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options); protected override BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options); } [Experimental("OPENAI001")] - public class CodeInterpreterToolImageOutput : CodeInterpreterToolOutput, IJsonModel, IPersistableModel { - public CodeInterpreterToolImageOutput(Uri imageUri); - public Uri ImageUri { get; set; } - protected override CodeInterpreterToolOutput JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options); - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options); - protected override CodeInterpreterToolOutput PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options); - protected override BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options); - } - [Experimental("OPENAI001")] - public class CodeInterpreterToolLogsOutput : CodeInterpreterToolOutput, IJsonModel, IPersistableModel { - public CodeInterpreterToolLogsOutput(string logs); - public string Logs { get; set; } - protected override CodeInterpreterToolOutput JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options); - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options); - protected override CodeInterpreterToolOutput PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options); - protected override BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options); + public class CodeInterpreterToolContainer : IJsonModel, IPersistableModel { + public CodeInterpreterToolContainer(CodeInterpreterToolContainerConfiguration containerConfiguration); + public CodeInterpreterToolContainer(string containerId); + public CodeInterpreterToolContainerConfiguration ContainerConfiguration { get; } + public string ContainerId { get; } + protected virtual CodeInterpreterToolContainer JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options); + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options); + protected virtual CodeInterpreterToolContainer PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options); + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options); } [Experimental("OPENAI001")] - public class CodeInterpreterToolOutput : IJsonModel, IPersistableModel { - protected virtual CodeInterpreterToolOutput JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options); + public class CodeInterpreterToolContainerConfiguration : IJsonModel, IPersistableModel { + public static AutomaticCodeInterpreterToolContainerConfiguration CreateAutomaticContainerConfiguration(IEnumerable fileIds = null); + protected virtual CodeInterpreterToolContainerConfiguration JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options); protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options); - protected virtual CodeInterpreterToolOutput PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options); + protected virtual CodeInterpreterToolContainerConfiguration PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options); protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options); } [Experimental("OPENAICUA001")] @@ -5598,7 +5598,7 @@ public class ResponseTokenUsage : IJsonModel, IPersistableMo } [Experimental("OPENAI001")] public class ResponseTool : IJsonModel, IPersistableModel { - public static CodeInterpreterTool CreateCodeInterpreterTool(CodeInterpreterContainer container); + public static CodeInterpreterTool CreateCodeInterpreterTool(CodeInterpreterToolContainer container); [Experimental("OPENAICUA001")] public static ComputerTool CreateComputerTool(ComputerToolEnvironment environment, int displayWidth, int displayHeight); public static FileSearchTool CreateFileSearchTool(IEnumerable vectorStoreIds, int? maxResultCount = null, FileSearchToolRankingOptions rankingOptions = null, BinaryData filters = null); diff --git a/api/OpenAI.netstandard2.0.cs b/api/OpenAI.netstandard2.0.cs index 8bf07771e..03f0f08d5 100644 --- a/api/OpenAI.netstandard2.0.cs +++ b/api/OpenAI.netstandard2.0.cs @@ -4035,20 +4035,41 @@ public class TurnDetectionOptions : IJsonModel, IPersistab } } namespace OpenAI.Responses { - public class AutomaticCodeInterpreterContainerConfiguration : CodeInterpreterContainerConfiguration, IJsonModel, IPersistableModel { - public AutomaticCodeInterpreterContainerConfiguration(); - public AutomaticCodeInterpreterContainerConfiguration(IEnumerable fileIds = null); + public class AutomaticCodeInterpreterToolContainerConfiguration : CodeInterpreterToolContainerConfiguration, IJsonModel, IPersistableModel { + public AutomaticCodeInterpreterToolContainerConfiguration(); public IList FileIds { get; } - protected override CodeInterpreterContainerConfiguration JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options); + protected override CodeInterpreterToolContainerConfiguration JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options); protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options); - protected override CodeInterpreterContainerConfiguration PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options); + protected override CodeInterpreterToolContainerConfiguration PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options); protected override BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options); } + public class CodeInterpreterCallImageOutput : CodeInterpreterCallOutput, IJsonModel, IPersistableModel { + public CodeInterpreterCallImageOutput(Uri imageUri); + public Uri ImageUri { get; set; } + protected override CodeInterpreterCallOutput JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options); + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options); + protected override CodeInterpreterCallOutput PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options); + protected override BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options); + } + public class CodeInterpreterCallLogsOutput : CodeInterpreterCallOutput, IJsonModel, IPersistableModel { + public CodeInterpreterCallLogsOutput(string logs); + public string Logs { get; set; } + protected override CodeInterpreterCallOutput JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options); + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options); + protected override CodeInterpreterCallOutput PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options); + protected override BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options); + } + public class CodeInterpreterCallOutput : IJsonModel, IPersistableModel { + protected virtual CodeInterpreterCallOutput JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options); + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options); + protected virtual CodeInterpreterCallOutput PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options); + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options); + } public class CodeInterpreterCallResponseItem : ResponseItem, IJsonModel, IPersistableModel { public CodeInterpreterCallResponseItem(string code); public string Code { get; set; } public string ContainerId { get; set; } - public IList Outputs { get; } + public IList Outputs { get; } public CodeInterpreterCallStatus? Status { get; } protected override ResponseItem JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options); protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options); @@ -4062,51 +4083,29 @@ public enum CodeInterpreterCallStatus { Incomplete = 3, Failed = 4 } - public class CodeInterpreterContainer : IJsonModel, IPersistableModel { - public CodeInterpreterContainer(CodeInterpreterContainerConfiguration containerConfiguration); - public CodeInterpreterContainer(string containerId); - public CodeInterpreterContainerConfiguration Container { get; set; } - public string ContainerId { get; set; } - protected virtual CodeInterpreterContainer JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options); - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options); - protected virtual CodeInterpreterContainer PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options); - protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options); - } - public class CodeInterpreterContainerConfiguration : IJsonModel, IPersistableModel { - public static AutomaticCodeInterpreterContainerConfiguration CreateAutomaticConfiguration(IEnumerable fileIds = null); - protected virtual CodeInterpreterContainerConfiguration JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options); - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options); - protected virtual CodeInterpreterContainerConfiguration PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options); - protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options); - } public class CodeInterpreterTool : ResponseTool, IJsonModel, IPersistableModel { - public CodeInterpreterTool(CodeInterpreterContainer container); - public CodeInterpreterContainer Container { get; } + public CodeInterpreterTool(CodeInterpreterToolContainer container); + public CodeInterpreterToolContainer Container { get; } protected override ResponseTool JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options); protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options); protected override ResponseTool PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options); protected override BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options); } - public class CodeInterpreterToolImageOutput : CodeInterpreterToolOutput, IJsonModel, IPersistableModel { - public CodeInterpreterToolImageOutput(Uri imageUri); - public Uri ImageUri { get; set; } - protected override CodeInterpreterToolOutput JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options); - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options); - protected override CodeInterpreterToolOutput PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options); - protected override BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options); - } - public class CodeInterpreterToolLogsOutput : CodeInterpreterToolOutput, IJsonModel, IPersistableModel { - public CodeInterpreterToolLogsOutput(string logs); - public string Logs { get; set; } - protected override CodeInterpreterToolOutput JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options); - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options); - protected override CodeInterpreterToolOutput PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options); - protected override BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options); + public class CodeInterpreterToolContainer : IJsonModel, IPersistableModel { + public CodeInterpreterToolContainer(CodeInterpreterToolContainerConfiguration containerConfiguration); + public CodeInterpreterToolContainer(string containerId); + public CodeInterpreterToolContainerConfiguration ContainerConfiguration { get; } + public string ContainerId { get; } + protected virtual CodeInterpreterToolContainer JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options); + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options); + protected virtual CodeInterpreterToolContainer PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options); + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options); } - public class CodeInterpreterToolOutput : IJsonModel, IPersistableModel { - protected virtual CodeInterpreterToolOutput JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options); + public class CodeInterpreterToolContainerConfiguration : IJsonModel, IPersistableModel { + public static AutomaticCodeInterpreterToolContainerConfiguration CreateAutomaticContainerConfiguration(IEnumerable fileIds = null); + protected virtual CodeInterpreterToolContainerConfiguration JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options); protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options); - protected virtual CodeInterpreterToolOutput PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options); + protected virtual CodeInterpreterToolContainerConfiguration PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options); protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options); } public class ComputerCallAction : IJsonModel, IPersistableModel { @@ -4947,7 +4946,7 @@ public class ResponseTokenUsage : IJsonModel, IPersistableMo protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options); } public class ResponseTool : IJsonModel, IPersistableModel { - public static CodeInterpreterTool CreateCodeInterpreterTool(CodeInterpreterContainer container); + public static CodeInterpreterTool CreateCodeInterpreterTool(CodeInterpreterToolContainer container); public static ComputerTool CreateComputerTool(ComputerToolEnvironment environment, int displayWidth, int displayHeight); public static FileSearchTool CreateFileSearchTool(IEnumerable vectorStoreIds, int? maxResultCount = null, FileSearchToolRankingOptions rankingOptions = null, BinaryData filters = null); public static FunctionTool CreateFunctionTool(string functionName, BinaryData functionParameters, bool? strictModeEnabled, string functionDescription = null); diff --git a/scripts/Test-ApiCompatibility.ps1 b/scripts/Test-ApiCompatibility.ps1 index aed045b08..ae31f6a69 100644 --- a/scripts/Test-ApiCompatibility.ps1 +++ b/scripts/Test-ApiCompatibility.ps1 @@ -177,5 +177,5 @@ $experimentalNamespaces = @( Invoke-APICompat -ProjectPath $projectPath ` -ReleasePath $releasePath ` -PackageName "OpenAI" ` - -BaselineVersion "2.3.0" ` + -BaselineVersion "2.4.0" ` -IgnoredNamespaces $experimentalNamespaces \ No newline at end of file diff --git a/specification/base/typespec/responses/custom.tsp b/specification/base/typespec/responses/custom.tsp index febb27ba8..f3279bfee 100644 --- a/specification/base/typespec/responses/custom.tsp +++ b/specification/base/typespec/responses/custom.tsp @@ -42,7 +42,7 @@ union CodeInterpreterContainerConfigurationType { auto: "auto", } -@discriminator("type") +@discriminator("type") model CodeInterpreterContainerConfiguration { @doc("The type of the output.") type: CodeInterpreterContainerConfigurationType; diff --git a/specification/client/models/responses.models.tsp b/specification/client/models/responses.models.tsp index 355df3f4a..1839d40b4 100644 --- a/specification/client/models/responses.models.tsp +++ b/specification/client/models/responses.models.tsp @@ -63,7 +63,7 @@ model DotNetToolCallApprovalPolicy { @access(Access.public) @usage(Usage.input | Usage.output) -model DotNetCodeInterpreterContainer { +model DotNetCodeInterpreterToolContainer { container_id?: string; container?: CodeInterpreterContainerConfiguration; } diff --git a/src/Custom/Responses/GeneratorStubs.cs b/src/Custom/Responses/GeneratorStubs.cs deleted file mode 100644 index 944aa715f..000000000 --- a/src/Custom/Responses/GeneratorStubs.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace OpenAI.Responses; - -[CodeGenType("CodeInterpreterToolImageOutput")] public partial class CodeInterpreterToolImageOutput {} -[CodeGenType("CodeInterpreterToolLogsOutput")] public partial class CodeInterpreterToolLogsOutput {} -[CodeGenType("CodeInterpreterToolOutput")] public partial class CodeInterpreterToolOutput {} -[CodeGenType("CodeInterpreterToolAuto")] public partial class AutomaticCodeInterpreterContainerConfiguration {} -[CodeGenType("CodeInterpreterContainerConfiguration")] public partial class CodeInterpreterContainerConfiguration {} \ No newline at end of file diff --git a/src/Custom/Responses/Items/CodeInterpreterTool/CodeInterpreterCallImageOutput.cs b/src/Custom/Responses/Items/CodeInterpreterTool/CodeInterpreterCallImageOutput.cs new file mode 100644 index 000000000..99f121eca --- /dev/null +++ b/src/Custom/Responses/Items/CodeInterpreterTool/CodeInterpreterCallImageOutput.cs @@ -0,0 +1,7 @@ +namespace OpenAI.Responses; + +// CUSTOM: Renamed. +[CodeGenType("CodeInterpreterToolImageOutput")] +public partial class CodeInterpreterCallImageOutput +{ +} \ No newline at end of file diff --git a/src/Custom/Responses/Items/CodeInterpreterTool/CodeInterpreterCallLogsOutput.cs b/src/Custom/Responses/Items/CodeInterpreterTool/CodeInterpreterCallLogsOutput.cs new file mode 100644 index 000000000..e8c8dfa31 --- /dev/null +++ b/src/Custom/Responses/Items/CodeInterpreterTool/CodeInterpreterCallLogsOutput.cs @@ -0,0 +1,7 @@ +namespace OpenAI.Responses; + +// CUSTOM: Renamed. +[CodeGenType("CodeInterpreterToolLogsOutput")] +public partial class CodeInterpreterCallLogsOutput +{ +} \ No newline at end of file diff --git a/src/Custom/Responses/Items/CodeInterpreterTool/CodeInterpreterCallOutput.cs b/src/Custom/Responses/Items/CodeInterpreterTool/CodeInterpreterCallOutput.cs new file mode 100644 index 000000000..a1f074c72 --- /dev/null +++ b/src/Custom/Responses/Items/CodeInterpreterTool/CodeInterpreterCallOutput.cs @@ -0,0 +1,7 @@ +namespace OpenAI.Responses; + +// CUSTOM: Renamed. +[CodeGenType("CodeInterpreterToolOutput")] +public partial class CodeInterpreterCallOutput +{ +} \ No newline at end of file diff --git a/src/Custom/Responses/Items/CodeInterpreterTool/CodeInterpreterCallStatus.cs b/src/Custom/Responses/Items/CodeInterpreterTool/CodeInterpreterCallStatus.cs index a0848a266..15e4f5fb1 100644 --- a/src/Custom/Responses/Items/CodeInterpreterTool/CodeInterpreterCallStatus.cs +++ b/src/Custom/Responses/Items/CodeInterpreterTool/CodeInterpreterCallStatus.cs @@ -1,6 +1,12 @@ +using System.Diagnostics.CodeAnalysis; + namespace OpenAI.Responses; -// CUSTOM: Renamed and made public. Recreated as CLR enum. +// CUSTOM: +// - Added Experimental attribute. +// - Renamed. +// - Recreated as CLR enum. +[Experimental("OPENAI001")] [CodeGenType("CodeInterpreterToolCallItemResourceStatus")] public enum CodeInterpreterCallStatus { diff --git a/src/Custom/Responses/Tools/AutomaticCodeInterpreterContainerConfiguration.cs b/src/Custom/Responses/Tools/AutomaticCodeInterpreterContainerConfiguration.cs deleted file mode 100644 index 09eb11e91..000000000 --- a/src/Custom/Responses/Tools/AutomaticCodeInterpreterContainerConfiguration.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System.Collections.Generic; - -namespace OpenAI.Responses; - -/// -/// Represents a configuration for an automatic Code Interpreter container. -/// -public partial class AutomaticCodeInterpreterContainerConfiguration : CodeInterpreterContainerConfiguration -{ - - /// - /// Initializes a new instance of the class. - /// - /// - public AutomaticCodeInterpreterContainerConfiguration(IEnumerable fileIds = null) - { - if (fileIds != null) - { - FileIds = [.. fileIds]; - } - else - { - FileIds = new List(); - } - } -} \ No newline at end of file diff --git a/src/Custom/Responses/Tools/AutomaticCodeInterpreterToolContainerConfiguration.cs b/src/Custom/Responses/Tools/AutomaticCodeInterpreterToolContainerConfiguration.cs new file mode 100644 index 000000000..1914a3569 --- /dev/null +++ b/src/Custom/Responses/Tools/AutomaticCodeInterpreterToolContainerConfiguration.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; + +namespace OpenAI.Responses; + +/// +/// Represents a configuration for an automatic Code Interpreter container. +/// +[CodeGenType("CodeInterpreterToolAuto")] +public partial class AutomaticCodeInterpreterToolContainerConfiguration +{ +} \ No newline at end of file diff --git a/src/Custom/Responses/Tools/CodeInterpreterContainer.cs b/src/Custom/Responses/Tools/CodeInterpreterContainer.cs deleted file mode 100644 index c97dfccaf..000000000 --- a/src/Custom/Responses/Tools/CodeInterpreterContainer.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System; -using System.Linq; - -namespace OpenAI.Responses; - -/// -/// Represents a container for the code interpreter tool. -/// -[CodeGenType("DotNetCodeInterpreterContainer")] -public partial class CodeInterpreterContainer -{ - internal CodeInterpreterContainer() - { - } - - /// - /// Initializes a new instance of the class. - /// - /// The ID of the container. - public CodeInterpreterContainer(string containerId) - { - ContainerId = containerId; - } - - /// - /// Initializes a new instance of the class. - /// - /// The configuration of the container. - public CodeInterpreterContainer(CodeInterpreterContainerConfiguration containerConfiguration) - { - Container = containerConfiguration; - } - - internal BinaryData AsBinaryData() - { - return this.ContainerId != null - ? new BinaryData($"\"{ContainerId}\"") - : Container is AutomaticCodeInterpreterContainerConfiguration autoConfig && autoConfig.FileIds?.Any() == true ? - new BinaryData($"{{\"type\": \"auto\", \"file_ids\": [{string.Join(", ", autoConfig.FileIds.Select(id => $"\"{id}\""))}]}}") : - new BinaryData("{\"type\": \"auto\"}"); - } -} \ No newline at end of file diff --git a/src/Custom/Responses/Tools/CodeInterpreterContainerConfiguration.cs b/src/Custom/Responses/Tools/CodeInterpreterContainerConfiguration.cs deleted file mode 100644 index 273cff88e..000000000 --- a/src/Custom/Responses/Tools/CodeInterpreterContainerConfiguration.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Collections.Generic; - -namespace OpenAI.Responses; - -/// -/// Represents the configuration for a Code Interpreter container. -/// -public partial class CodeInterpreterContainerConfiguration -{ - - /// - /// Creates a new instance of the class. - /// - /// The list of file IDs associated with the container. - /// A new instance of the class. - public static AutomaticCodeInterpreterContainerConfiguration CreateAutomaticConfiguration(IEnumerable fileIds = null) => - new AutomaticCodeInterpreterContainerConfiguration(fileIds); -} \ No newline at end of file diff --git a/src/Custom/Responses/Tools/CodeInterpreterTool.Serialization.cs b/src/Custom/Responses/Tools/CodeInterpreterTool.Serialization.cs deleted file mode 100644 index 19612a9c2..000000000 --- a/src/Custom/Responses/Tools/CodeInterpreterTool.Serialization.cs +++ /dev/null @@ -1,61 +0,0 @@ -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using OpenAI; - -namespace OpenAI.Responses -{ - public partial class CodeInterpreterTool : IJsonModel - { - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(CodeInterpreterTool)} does not support writing '{format}' format."); - } - base.JsonModelWriteCore(writer, options); - if (_additionalBinaryDataProperties?.ContainsKey("container") != true) - { - writer.WritePropertyName("container"u8); -#if NET6_0_OR_GREATER - writer.WriteRawValue(Container.AsBinaryData()); -#else - using (JsonDocument document = JsonDocument.Parse(Container.AsBinaryData())) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - - internal static CodeInterpreterTool DeserializeCodeInterpreterTool(JsonElement element, ModelReaderWriterOptions options) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - InternalToolType kind = default; - IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); - CodeInterpreterContainer container = default; - - foreach (var prop in element.EnumerateObject()) - { - if (prop.NameEquals("type"u8)) - { - kind = new InternalToolType(prop.Value.GetString()); - continue; - } - if (prop.NameEquals("container"u8)) - { - container = CodeInterpreterContainer.DeserializeCodeInterpreterContainer(prop.Value, options); - continue; - } - // Plugin customization: remove options.Format != "W" check - additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); - } - return new CodeInterpreterTool(kind, additionalBinaryDataProperties, container); - } - } -} diff --git a/src/Custom/Responses/Tools/CodeInterpreterTool.cs b/src/Custom/Responses/Tools/CodeInterpreterTool.cs index 7be08936f..ffaaf9d2f 100644 --- a/src/Custom/Responses/Tools/CodeInterpreterTool.cs +++ b/src/Custom/Responses/Tools/CodeInterpreterTool.cs @@ -1,11 +1,10 @@ -using System; - -namespace OpenAI.Responses; +namespace OpenAI.Responses; // CUSTOM: correct namespace / customize Container property. [CodeGenType("CodeInterpreterTool")] public partial class CodeInterpreterTool { + // CUSTOM: Changed type from BinaryData (generated from the original union) to a custom type. [CodeGenMember("Container")] - public CodeInterpreterContainer Container { get; } + public CodeInterpreterToolContainer Container { get; } } \ No newline at end of file diff --git a/src/Custom/Responses/Tools/CodeInterpreterToolContainer.Serialization.cs b/src/Custom/Responses/Tools/CodeInterpreterToolContainer.Serialization.cs new file mode 100644 index 000000000..97f027033 --- /dev/null +++ b/src/Custom/Responses/Tools/CodeInterpreterToolContainer.Serialization.cs @@ -0,0 +1,63 @@ +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; + + +namespace OpenAI.Responses; + +public partial class CodeInterpreterToolContainer +{ + // CUSTOM: Edited to remove calls to WriteStartObject() and WriteEndObject(). + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + JsonModelWriteCore(writer, options); + } + + // CUSTOM: + // - Edited to serialize the container ID component as a string value. + // - Edited to serialize the container configuration component as an object value. + // - Removed serialization of additional properties. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CodeInterpreterToolContainer)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(ContainerId) && _additionalBinaryDataProperties?.ContainsKey("container_id") != true) + { + writer.WriteStringValue(ContainerId); + } + if (Optional.IsDefined(ContainerConfiguration) && _additionalBinaryDataProperties?.ContainsKey("container") != true) + { + writer.WriteObjectValue(ContainerConfiguration, options); + } + } + + // CUSTOM: + // - Edited to deserialize a string value into a container ID component. + // - Edited to deserialize an object value into a container configuration component. + internal static CodeInterpreterToolContainer DeserializeCodeInterpreterToolContainer(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + + string containerId = default; + CodeInterpreterToolContainerConfiguration container = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + + if (element.ValueKind == JsonValueKind.String) + { + containerId = element.GetString(); + } + else + { + container = CodeInterpreterToolContainerConfiguration.DeserializeCodeInterpreterToolContainerConfiguration(element, options); + } + + return new CodeInterpreterToolContainer(containerId, container, additionalBinaryDataProperties); + } +} diff --git a/src/Custom/Responses/Tools/CodeInterpreterToolContainer.cs b/src/Custom/Responses/Tools/CodeInterpreterToolContainer.cs new file mode 100644 index 000000000..f1b0d5563 --- /dev/null +++ b/src/Custom/Responses/Tools/CodeInterpreterToolContainer.cs @@ -0,0 +1,46 @@ +namespace OpenAI.Responses; + +// CUSTOM: This type represents a non-discriminated union of the following components: +// * A container ID defined as a string. +// * A container configuration defined as an object. +/// +/// Represents a container for the code interpreter tool. +/// +[CodeGenType("DotNetCodeInterpreterToolContainer")] +public partial class CodeInterpreterToolContainer +{ + // CUSTOM: Made internal. + internal CodeInterpreterToolContainer() + { + } + + // CUSTOM: Added to support the corresponding component of the union. + /// + /// Initializes a new instance of the class. + /// + /// The ID of the container. + public CodeInterpreterToolContainer(string containerId) + { + ContainerId = containerId; + } + + // CUSTOM: Added to support the corresponding component of the union. + /// + /// Initializes a new instance of the class. + /// + /// The configuration of the container. + public CodeInterpreterToolContainer(CodeInterpreterToolContainerConfiguration containerConfiguration) + { + ContainerConfiguration = containerConfiguration; + } + + // CUSTOM: Removed setter. + [CodeGenMember("ContainerId")] + public string ContainerId { get; } + + // CUSTOM: + // - Renamed. + // - Removed setter. + [CodeGenMember("Container")] + public CodeInterpreterToolContainerConfiguration ContainerConfiguration { get; } +} \ No newline at end of file diff --git a/src/Custom/Responses/Tools/CodeInterpreterToolContainerConfiguration.cs b/src/Custom/Responses/Tools/CodeInterpreterToolContainerConfiguration.cs new file mode 100644 index 000000000..493ae261c --- /dev/null +++ b/src/Custom/Responses/Tools/CodeInterpreterToolContainerConfiguration.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; + +namespace OpenAI.Responses; + +/// +/// Represents the configuration for a Code Interpreter container. +/// +[CodeGenType("CodeInterpreterContainerConfiguration")] +public partial class CodeInterpreterToolContainerConfiguration +{ + /// + /// Creates a new instance of the class. + /// + /// The list of file IDs associated with the container. + /// A new instance of the class. + public static AutomaticCodeInterpreterToolContainerConfiguration CreateAutomaticContainerConfiguration(IEnumerable fileIds = null) + { + return new AutomaticCodeInterpreterToolContainerConfiguration( + kind: InternalCodeInterpreterContainerConfigurationType.Auto, + additionalBinaryDataProperties: null, + fileIds: fileIds.ToList()); + } +} \ No newline at end of file diff --git a/src/Custom/Responses/Tools/McpTool/McpToolCallApprovalPolicy.cs b/src/Custom/Responses/Tools/McpTool/McpToolCallApprovalPolicy.cs index b9af4fe0e..f00b4e361 100644 --- a/src/Custom/Responses/Tools/McpTool/McpToolCallApprovalPolicy.cs +++ b/src/Custom/Responses/Tools/McpTool/McpToolCallApprovalPolicy.cs @@ -24,8 +24,10 @@ public McpToolCallApprovalPolicy(CustomMcpToolCallApprovalPolicy customPolicy) } // CUSTOM: Removed setter. + [CodeGenMember("GlobalPolicy")] public GlobalMcpToolCallApprovalPolicy? GlobalPolicy { get; } // CUSTOM: Removed setter. + [CodeGenMember("CustomPolicy")] public CustomMcpToolCallApprovalPolicy CustomPolicy { get; } } diff --git a/src/Custom/Responses/Tools/ResponseTool.cs b/src/Custom/Responses/Tools/ResponseTool.cs index d27d40813..952dd45b7 100644 --- a/src/Custom/Responses/Tools/ResponseTool.cs +++ b/src/Custom/Responses/Tools/ResponseTool.cs @@ -101,7 +101,7 @@ public static McpTool CreateMcpTool(string serverLabel, McpToolConnectorId conne /// /// The container for the code interpreter. /// A new instance of the class. - public static CodeInterpreterTool CreateCodeInterpreterTool(CodeInterpreterContainer container) + public static CodeInterpreterTool CreateCodeInterpreterTool(CodeInterpreterToolContainer container) { Argument.AssertNotNull(container, nameof(container)); diff --git a/src/Generated/Models/OpenAIContext.cs b/src/Generated/Models/OpenAIContext.cs index 6cdee87c6..42fcf5fd9 100644 --- a/src/Generated/Models/OpenAIContext.cs +++ b/src/Generated/Models/OpenAIContext.cs @@ -37,7 +37,7 @@ namespace OpenAI [ModelReaderWriterBuildable(typeof(AudioTranscriptionOptions))] [ModelReaderWriterBuildable(typeof(AudioTranslation))] [ModelReaderWriterBuildable(typeof(AudioTranslationOptions))] - [ModelReaderWriterBuildable(typeof(AutomaticCodeInterpreterContainerConfiguration))] + [ModelReaderWriterBuildable(typeof(AutomaticCodeInterpreterToolContainerConfiguration))] [ModelReaderWriterBuildable(typeof(ChatAudioOptions))] [ModelReaderWriterBuildable(typeof(ChatCompletion))] [ModelReaderWriterBuildable(typeof(ChatCompletionCollectionOptions))] @@ -64,14 +64,14 @@ namespace OpenAI [ModelReaderWriterBuildable(typeof(ChatToolCall))] [ModelReaderWriterBuildable(typeof(ChatToolChoice))] [ModelReaderWriterBuildable(typeof(ChatWebSearchOptions))] + [ModelReaderWriterBuildable(typeof(CodeInterpreterCallImageOutput))] + [ModelReaderWriterBuildable(typeof(CodeInterpreterCallLogsOutput))] + [ModelReaderWriterBuildable(typeof(CodeInterpreterCallOutput))] [ModelReaderWriterBuildable(typeof(CodeInterpreterCallResponseItem))] - [ModelReaderWriterBuildable(typeof(CodeInterpreterContainer))] - [ModelReaderWriterBuildable(typeof(CodeInterpreterContainerConfiguration))] [ModelReaderWriterBuildable(typeof(CodeInterpreterTool))] + [ModelReaderWriterBuildable(typeof(CodeInterpreterToolContainer))] + [ModelReaderWriterBuildable(typeof(CodeInterpreterToolContainerConfiguration))] [ModelReaderWriterBuildable(typeof(CodeInterpreterToolDefinition))] - [ModelReaderWriterBuildable(typeof(CodeInterpreterToolImageOutput))] - [ModelReaderWriterBuildable(typeof(CodeInterpreterToolLogsOutput))] - [ModelReaderWriterBuildable(typeof(CodeInterpreterToolOutput))] [ModelReaderWriterBuildable(typeof(CodeInterpreterToolResources))] [ModelReaderWriterBuildable(typeof(ComputerCallAction))] [ModelReaderWriterBuildable(typeof(ComputerCallOutput))] diff --git a/src/Generated/Models/Responses/AutomaticCodeInterpreterContainerConfiguration.cs b/src/Generated/Models/Responses/AutomaticCodeInterpreterContainerConfiguration.cs deleted file mode 100644 index 45d652027..000000000 --- a/src/Generated/Models/Responses/AutomaticCodeInterpreterContainerConfiguration.cs +++ /dev/null @@ -1,27 +0,0 @@ -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using OpenAI; - -namespace OpenAI.Responses -{ - [Experimental("OPENAI001")] - public partial class AutomaticCodeInterpreterContainerConfiguration : CodeInterpreterContainerConfiguration - { - public AutomaticCodeInterpreterContainerConfiguration() : this(InternalCodeInterpreterContainerConfigurationType.Auto, null, null) - { - } - - internal AutomaticCodeInterpreterContainerConfiguration(InternalCodeInterpreterContainerConfigurationType kind, IDictionary additionalBinaryDataProperties, IList fileIds) : base(kind, additionalBinaryDataProperties) - { - // Plugin customization: ensure initialization of collections - FileIds = fileIds ?? new ChangeTrackingList(); - } - - public IList FileIds { get; } - } -} diff --git a/src/Generated/Models/Responses/AutomaticCodeInterpreterContainerConfiguration.Serialization.cs b/src/Generated/Models/Responses/AutomaticCodeInterpreterToolContainerConfiguration.Serialization.cs similarity index 59% rename from src/Generated/Models/Responses/AutomaticCodeInterpreterContainerConfiguration.Serialization.cs rename to src/Generated/Models/Responses/AutomaticCodeInterpreterToolContainerConfiguration.Serialization.cs index 184ba9224..f5aa05ec1 100644 --- a/src/Generated/Models/Responses/AutomaticCodeInterpreterContainerConfiguration.Serialization.cs +++ b/src/Generated/Models/Responses/AutomaticCodeInterpreterToolContainerConfiguration.Serialization.cs @@ -10,9 +10,9 @@ namespace OpenAI.Responses { - public partial class AutomaticCodeInterpreterContainerConfiguration : IJsonModel + public partial class AutomaticCodeInterpreterToolContainerConfiguration : IJsonModel { - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -21,10 +21,10 @@ void IJsonModel.Write(Utf8JsonWr protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(AutomaticCodeInterpreterContainerConfiguration)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(AutomaticCodeInterpreterToolContainerConfiguration)} does not support writing '{format}' format."); } base.JsonModelWriteCore(writer, options); if (Optional.IsCollectionDefined(FileIds) && _additionalBinaryDataProperties?.ContainsKey("file_ids") != true) @@ -44,20 +44,20 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } } - AutomaticCodeInterpreterContainerConfiguration IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (AutomaticCodeInterpreterContainerConfiguration)JsonModelCreateCore(ref reader, options); + AutomaticCodeInterpreterToolContainerConfiguration IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (AutomaticCodeInterpreterToolContainerConfiguration)JsonModelCreateCore(ref reader, options); - protected override CodeInterpreterContainerConfiguration JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + protected override CodeInterpreterToolContainerConfiguration JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(AutomaticCodeInterpreterContainerConfiguration)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(AutomaticCodeInterpreterToolContainerConfiguration)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAutomaticCodeInterpreterContainerConfiguration(document.RootElement, options); + return DeserializeAutomaticCodeInterpreterToolContainerConfiguration(document.RootElement, options); } - internal static AutomaticCodeInterpreterContainerConfiguration DeserializeAutomaticCodeInterpreterContainerConfiguration(JsonElement element, ModelReaderWriterOptions options) + internal static AutomaticCodeInterpreterToolContainerConfiguration DeserializeAutomaticCodeInterpreterToolContainerConfiguration(JsonElement element, ModelReaderWriterOptions options) { if (element.ValueKind == JsonValueKind.Null) { @@ -97,40 +97,40 @@ internal static AutomaticCodeInterpreterContainerConfiguration DeserializeAutoma // Plugin customization: remove options.Format != "W" check additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } - return new AutomaticCodeInterpreterContainerConfiguration(kind, additionalBinaryDataProperties, fileIds ?? new ChangeTrackingList()); + return new AutomaticCodeInterpreterToolContainerConfiguration(kind, additionalBinaryDataProperties, fileIds ?? new ChangeTrackingList()); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); protected override BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options, OpenAIContext.Default); default: - throw new FormatException($"The model {nameof(AutomaticCodeInterpreterContainerConfiguration)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(AutomaticCodeInterpreterToolContainerConfiguration)} does not support writing '{options.Format}' format."); } } - AutomaticCodeInterpreterContainerConfiguration IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (AutomaticCodeInterpreterContainerConfiguration)PersistableModelCreateCore(data, options); + AutomaticCodeInterpreterToolContainerConfiguration IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (AutomaticCodeInterpreterToolContainerConfiguration)PersistableModelCreateCore(data, options); - protected override CodeInterpreterContainerConfiguration PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + protected override CodeInterpreterToolContainerConfiguration PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": using (JsonDocument document = JsonDocument.Parse(data)) { - return DeserializeAutomaticCodeInterpreterContainerConfiguration(document.RootElement, options); + return DeserializeAutomaticCodeInterpreterToolContainerConfiguration(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(AutomaticCodeInterpreterContainerConfiguration)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(AutomaticCodeInterpreterToolContainerConfiguration)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/src/Generated/Models/Responses/AutomaticCodeInterpreterToolContainerConfiguration.cs b/src/Generated/Models/Responses/AutomaticCodeInterpreterToolContainerConfiguration.cs new file mode 100644 index 000000000..6276a482b --- /dev/null +++ b/src/Generated/Models/Responses/AutomaticCodeInterpreterToolContainerConfiguration.cs @@ -0,0 +1,27 @@ +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using OpenAI; + +namespace OpenAI.Responses +{ + [Experimental("OPENAI001")] + public partial class AutomaticCodeInterpreterToolContainerConfiguration : CodeInterpreterToolContainerConfiguration + { + public AutomaticCodeInterpreterToolContainerConfiguration() : this(InternalCodeInterpreterContainerConfigurationType.Auto, null, null) + { + } + + internal AutomaticCodeInterpreterToolContainerConfiguration(InternalCodeInterpreterContainerConfigurationType kind, IDictionary additionalBinaryDataProperties, IList fileIds) : base(kind, additionalBinaryDataProperties) + { + // Plugin customization: ensure initialization of collections + FileIds = fileIds ?? new ChangeTrackingList(); + } + + public IList FileIds { get; } + } +} diff --git a/src/Generated/Models/Responses/CodeInterpreterToolImageOutput.Serialization.cs b/src/Generated/Models/Responses/CodeInterpreterCallImageOutput.Serialization.cs similarity index 69% rename from src/Generated/Models/Responses/CodeInterpreterToolImageOutput.Serialization.cs rename to src/Generated/Models/Responses/CodeInterpreterCallImageOutput.Serialization.cs index 94c78564f..c626c20eb 100644 --- a/src/Generated/Models/Responses/CodeInterpreterToolImageOutput.Serialization.cs +++ b/src/Generated/Models/Responses/CodeInterpreterCallImageOutput.Serialization.cs @@ -10,13 +10,13 @@ namespace OpenAI.Responses { - public partial class CodeInterpreterToolImageOutput : IJsonModel + public partial class CodeInterpreterCallImageOutput : IJsonModel { - internal CodeInterpreterToolImageOutput() : this(InternalCodeInterpreterToolOutputType.Image, null, null) + internal CodeInterpreterCallImageOutput() : this(InternalCodeInterpreterToolOutputType.Image, null, null) { } - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -25,10 +25,10 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mod protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(CodeInterpreterToolImageOutput)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(CodeInterpreterCallImageOutput)} does not support writing '{format}' format."); } base.JsonModelWriteCore(writer, options); if (_additionalBinaryDataProperties?.ContainsKey("url") != true) @@ -38,20 +38,20 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } } - CodeInterpreterToolImageOutput IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (CodeInterpreterToolImageOutput)JsonModelCreateCore(ref reader, options); + CodeInterpreterCallImageOutput IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (CodeInterpreterCallImageOutput)JsonModelCreateCore(ref reader, options); - protected override CodeInterpreterToolOutput JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + protected override CodeInterpreterCallOutput JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(CodeInterpreterToolImageOutput)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(CodeInterpreterCallImageOutput)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeCodeInterpreterToolImageOutput(document.RootElement, options); + return DeserializeCodeInterpreterCallImageOutput(document.RootElement, options); } - internal static CodeInterpreterToolImageOutput DeserializeCodeInterpreterToolImageOutput(JsonElement element, ModelReaderWriterOptions options) + internal static CodeInterpreterCallImageOutput DeserializeCodeInterpreterCallImageOutput(JsonElement element, ModelReaderWriterOptions options) { if (element.ValueKind == JsonValueKind.Null) { @@ -75,40 +75,40 @@ internal static CodeInterpreterToolImageOutput DeserializeCodeInterpreterToolIma // Plugin customization: remove options.Format != "W" check additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } - return new CodeInterpreterToolImageOutput(kind, additionalBinaryDataProperties, imageUri); + return new CodeInterpreterCallImageOutput(kind, additionalBinaryDataProperties, imageUri); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); protected override BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options, OpenAIContext.Default); default: - throw new FormatException($"The model {nameof(CodeInterpreterToolImageOutput)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(CodeInterpreterCallImageOutput)} does not support writing '{options.Format}' format."); } } - CodeInterpreterToolImageOutput IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (CodeInterpreterToolImageOutput)PersistableModelCreateCore(data, options); + CodeInterpreterCallImageOutput IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (CodeInterpreterCallImageOutput)PersistableModelCreateCore(data, options); - protected override CodeInterpreterToolOutput PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + protected override CodeInterpreterCallOutput PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": using (JsonDocument document = JsonDocument.Parse(data)) { - return DeserializeCodeInterpreterToolImageOutput(document.RootElement, options); + return DeserializeCodeInterpreterCallImageOutput(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(CodeInterpreterToolImageOutput)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(CodeInterpreterCallImageOutput)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/src/Generated/Models/Responses/CodeInterpreterToolImageOutput.cs b/src/Generated/Models/Responses/CodeInterpreterCallImageOutput.cs similarity index 74% rename from src/Generated/Models/Responses/CodeInterpreterToolImageOutput.cs rename to src/Generated/Models/Responses/CodeInterpreterCallImageOutput.cs index 3c3123137..a6c2b1cf9 100644 --- a/src/Generated/Models/Responses/CodeInterpreterToolImageOutput.cs +++ b/src/Generated/Models/Responses/CodeInterpreterCallImageOutput.cs @@ -10,16 +10,16 @@ namespace OpenAI.Responses { [Experimental("OPENAI001")] - public partial class CodeInterpreterToolImageOutput : CodeInterpreterToolOutput + public partial class CodeInterpreterCallImageOutput : CodeInterpreterCallOutput { - public CodeInterpreterToolImageOutput(Uri imageUri) : base(InternalCodeInterpreterToolOutputType.Image) + public CodeInterpreterCallImageOutput(Uri imageUri) : base(InternalCodeInterpreterToolOutputType.Image) { Argument.AssertNotNull(imageUri, nameof(imageUri)); ImageUri = imageUri; } - internal CodeInterpreterToolImageOutput(InternalCodeInterpreterToolOutputType kind, IDictionary additionalBinaryDataProperties, Uri imageUri) : base(kind, additionalBinaryDataProperties) + internal CodeInterpreterCallImageOutput(InternalCodeInterpreterToolOutputType kind, IDictionary additionalBinaryDataProperties, Uri imageUri) : base(kind, additionalBinaryDataProperties) { ImageUri = imageUri; } diff --git a/src/Generated/Models/Responses/CodeInterpreterToolLogsOutput.Serialization.cs b/src/Generated/Models/Responses/CodeInterpreterCallLogsOutput.Serialization.cs similarity index 69% rename from src/Generated/Models/Responses/CodeInterpreterToolLogsOutput.Serialization.cs rename to src/Generated/Models/Responses/CodeInterpreterCallLogsOutput.Serialization.cs index 8ddfcbe22..d95f3a534 100644 --- a/src/Generated/Models/Responses/CodeInterpreterToolLogsOutput.Serialization.cs +++ b/src/Generated/Models/Responses/CodeInterpreterCallLogsOutput.Serialization.cs @@ -10,13 +10,13 @@ namespace OpenAI.Responses { - public partial class CodeInterpreterToolLogsOutput : IJsonModel + public partial class CodeInterpreterCallLogsOutput : IJsonModel { - internal CodeInterpreterToolLogsOutput() : this(InternalCodeInterpreterToolOutputType.Logs, null, null) + internal CodeInterpreterCallLogsOutput() : this(InternalCodeInterpreterToolOutputType.Logs, null, null) { } - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -25,10 +25,10 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mode protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(CodeInterpreterToolLogsOutput)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(CodeInterpreterCallLogsOutput)} does not support writing '{format}' format."); } base.JsonModelWriteCore(writer, options); if (_additionalBinaryDataProperties?.ContainsKey("logs") != true) @@ -38,20 +38,20 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } } - CodeInterpreterToolLogsOutput IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (CodeInterpreterToolLogsOutput)JsonModelCreateCore(ref reader, options); + CodeInterpreterCallLogsOutput IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (CodeInterpreterCallLogsOutput)JsonModelCreateCore(ref reader, options); - protected override CodeInterpreterToolOutput JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + protected override CodeInterpreterCallOutput JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(CodeInterpreterToolLogsOutput)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(CodeInterpreterCallLogsOutput)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeCodeInterpreterToolLogsOutput(document.RootElement, options); + return DeserializeCodeInterpreterCallLogsOutput(document.RootElement, options); } - internal static CodeInterpreterToolLogsOutput DeserializeCodeInterpreterToolLogsOutput(JsonElement element, ModelReaderWriterOptions options) + internal static CodeInterpreterCallLogsOutput DeserializeCodeInterpreterCallLogsOutput(JsonElement element, ModelReaderWriterOptions options) { if (element.ValueKind == JsonValueKind.Null) { @@ -75,40 +75,40 @@ internal static CodeInterpreterToolLogsOutput DeserializeCodeInterpreterToolLogs // Plugin customization: remove options.Format != "W" check additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } - return new CodeInterpreterToolLogsOutput(kind, additionalBinaryDataProperties, logs); + return new CodeInterpreterCallLogsOutput(kind, additionalBinaryDataProperties, logs); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); protected override BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options, OpenAIContext.Default); default: - throw new FormatException($"The model {nameof(CodeInterpreterToolLogsOutput)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(CodeInterpreterCallLogsOutput)} does not support writing '{options.Format}' format."); } } - CodeInterpreterToolLogsOutput IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (CodeInterpreterToolLogsOutput)PersistableModelCreateCore(data, options); + CodeInterpreterCallLogsOutput IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (CodeInterpreterCallLogsOutput)PersistableModelCreateCore(data, options); - protected override CodeInterpreterToolOutput PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + protected override CodeInterpreterCallOutput PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": using (JsonDocument document = JsonDocument.Parse(data)) { - return DeserializeCodeInterpreterToolLogsOutput(document.RootElement, options); + return DeserializeCodeInterpreterCallLogsOutput(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(CodeInterpreterToolLogsOutput)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(CodeInterpreterCallLogsOutput)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/src/Generated/Models/Responses/CodeInterpreterToolLogsOutput.cs b/src/Generated/Models/Responses/CodeInterpreterCallLogsOutput.cs similarity index 74% rename from src/Generated/Models/Responses/CodeInterpreterToolLogsOutput.cs rename to src/Generated/Models/Responses/CodeInterpreterCallLogsOutput.cs index 7df082c62..9b25900e7 100644 --- a/src/Generated/Models/Responses/CodeInterpreterToolLogsOutput.cs +++ b/src/Generated/Models/Responses/CodeInterpreterCallLogsOutput.cs @@ -10,16 +10,16 @@ namespace OpenAI.Responses { [Experimental("OPENAI001")] - public partial class CodeInterpreterToolLogsOutput : CodeInterpreterToolOutput + public partial class CodeInterpreterCallLogsOutput : CodeInterpreterCallOutput { - public CodeInterpreterToolLogsOutput(string logs) : base(InternalCodeInterpreterToolOutputType.Logs) + public CodeInterpreterCallLogsOutput(string logs) : base(InternalCodeInterpreterToolOutputType.Logs) { Argument.AssertNotNull(logs, nameof(logs)); Logs = logs; } - internal CodeInterpreterToolLogsOutput(InternalCodeInterpreterToolOutputType kind, IDictionary additionalBinaryDataProperties, string logs) : base(kind, additionalBinaryDataProperties) + internal CodeInterpreterCallLogsOutput(InternalCodeInterpreterToolOutputType kind, IDictionary additionalBinaryDataProperties, string logs) : base(kind, additionalBinaryDataProperties) { Logs = logs; } diff --git a/src/Generated/Models/Responses/CodeInterpreterToolOutput.Serialization.cs b/src/Generated/Models/Responses/CodeInterpreterCallOutput.Serialization.cs similarity index 71% rename from src/Generated/Models/Responses/CodeInterpreterToolOutput.Serialization.cs rename to src/Generated/Models/Responses/CodeInterpreterCallOutput.Serialization.cs index 2bc6f5693..cfdf62761 100644 --- a/src/Generated/Models/Responses/CodeInterpreterToolOutput.Serialization.cs +++ b/src/Generated/Models/Responses/CodeInterpreterCallOutput.Serialization.cs @@ -10,13 +10,13 @@ namespace OpenAI.Responses { [PersistableModelProxy(typeof(InternalUnknownCodeInterpreterToolOutput))] - public partial class CodeInterpreterToolOutput : IJsonModel + public partial class CodeInterpreterCallOutput : IJsonModel { - internal CodeInterpreterToolOutput() + internal CodeInterpreterCallOutput() { } - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -25,10 +25,10 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRea protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(CodeInterpreterToolOutput)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(CodeInterpreterCallOutput)} does not support writing '{format}' format."); } if (_additionalBinaryDataProperties?.ContainsKey("type") != true) { @@ -57,20 +57,20 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - CodeInterpreterToolOutput IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + CodeInterpreterCallOutput IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); - protected virtual CodeInterpreterToolOutput JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + protected virtual CodeInterpreterCallOutput JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(CodeInterpreterToolOutput)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(CodeInterpreterCallOutput)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeCodeInterpreterToolOutput(document.RootElement, options); + return DeserializeCodeInterpreterCallOutput(document.RootElement, options); } - internal static CodeInterpreterToolOutput DeserializeCodeInterpreterToolOutput(JsonElement element, ModelReaderWriterOptions options) + internal static CodeInterpreterCallOutput DeserializeCodeInterpreterCallOutput(JsonElement element, ModelReaderWriterOptions options) { if (element.ValueKind == JsonValueKind.Null) { @@ -81,45 +81,45 @@ internal static CodeInterpreterToolOutput DeserializeCodeInterpreterToolOutput(J switch (discriminator.GetString()) { case "logs": - return CodeInterpreterToolLogsOutput.DeserializeCodeInterpreterToolLogsOutput(element, options); + return CodeInterpreterCallLogsOutput.DeserializeCodeInterpreterCallLogsOutput(element, options); case "image": - return CodeInterpreterToolImageOutput.DeserializeCodeInterpreterToolImageOutput(element, options); + return CodeInterpreterCallImageOutput.DeserializeCodeInterpreterCallImageOutput(element, options); } } return InternalUnknownCodeInterpreterToolOutput.DeserializeInternalUnknownCodeInterpreterToolOutput(element, options); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options, OpenAIContext.Default); default: - throw new FormatException($"The model {nameof(CodeInterpreterToolOutput)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(CodeInterpreterCallOutput)} does not support writing '{options.Format}' format."); } } - CodeInterpreterToolOutput IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + CodeInterpreterCallOutput IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); - protected virtual CodeInterpreterToolOutput PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + protected virtual CodeInterpreterCallOutput PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": using (JsonDocument document = JsonDocument.Parse(data)) { - return DeserializeCodeInterpreterToolOutput(document.RootElement, options); + return DeserializeCodeInterpreterCallOutput(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(CodeInterpreterToolOutput)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(CodeInterpreterCallOutput)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/src/Generated/Models/Responses/CodeInterpreterToolOutput.cs b/src/Generated/Models/Responses/CodeInterpreterCallOutput.cs similarity index 82% rename from src/Generated/Models/Responses/CodeInterpreterToolOutput.cs rename to src/Generated/Models/Responses/CodeInterpreterCallOutput.cs index 3fe5e3e68..9a49d7053 100644 --- a/src/Generated/Models/Responses/CodeInterpreterToolOutput.cs +++ b/src/Generated/Models/Responses/CodeInterpreterCallOutput.cs @@ -9,16 +9,16 @@ namespace OpenAI.Responses { [Experimental("OPENAI001")] - public partial class CodeInterpreterToolOutput + public partial class CodeInterpreterCallOutput { private protected IDictionary _additionalBinaryDataProperties; - private protected CodeInterpreterToolOutput(InternalCodeInterpreterToolOutputType kind) + private protected CodeInterpreterCallOutput(InternalCodeInterpreterToolOutputType kind) { Kind = kind; } - internal CodeInterpreterToolOutput(InternalCodeInterpreterToolOutputType kind, IDictionary additionalBinaryDataProperties) + internal CodeInterpreterCallOutput(InternalCodeInterpreterToolOutputType kind, IDictionary additionalBinaryDataProperties) { Kind = kind; _additionalBinaryDataProperties = additionalBinaryDataProperties; diff --git a/src/Generated/Models/Responses/CodeInterpreterCallResponseItem.Serialization.cs b/src/Generated/Models/Responses/CodeInterpreterCallResponseItem.Serialization.cs index f42e2476e..22b689d70 100644 --- a/src/Generated/Models/Responses/CodeInterpreterCallResponseItem.Serialization.cs +++ b/src/Generated/Models/Responses/CodeInterpreterCallResponseItem.Serialization.cs @@ -51,7 +51,7 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri { writer.WritePropertyName("outputs"u8); writer.WriteStartArray(); - foreach (CodeInterpreterToolOutput item in Outputs) + foreach (CodeInterpreterCallOutput item in Outputs) { writer.WriteObjectValue(item, options); } @@ -84,7 +84,7 @@ internal static CodeInterpreterCallResponseItem DeserializeCodeInterpreterCallRe CodeInterpreterCallStatus? status = default; string containerId = default; string code = default; - IList outputs = default; + IList outputs = default; foreach (var prop in element.EnumerateObject()) { if (prop.NameEquals("type"u8)) @@ -118,10 +118,10 @@ internal static CodeInterpreterCallResponseItem DeserializeCodeInterpreterCallRe { continue; } - List array = new List(); + List array = new List(); foreach (var item in prop.Value.EnumerateArray()) { - array.Add(CodeInterpreterToolOutput.DeserializeCodeInterpreterToolOutput(item, options)); + array.Add(CodeInterpreterCallOutput.DeserializeCodeInterpreterCallOutput(item, options)); } outputs = array; continue; @@ -136,7 +136,7 @@ internal static CodeInterpreterCallResponseItem DeserializeCodeInterpreterCallRe status, containerId, code, - outputs ?? new ChangeTrackingList()); + outputs ?? new ChangeTrackingList()); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); diff --git a/src/Generated/Models/Responses/CodeInterpreterCallResponseItem.cs b/src/Generated/Models/Responses/CodeInterpreterCallResponseItem.cs index 22e85060b..92b90ea61 100644 --- a/src/Generated/Models/Responses/CodeInterpreterCallResponseItem.cs +++ b/src/Generated/Models/Responses/CodeInterpreterCallResponseItem.cs @@ -17,22 +17,22 @@ public CodeInterpreterCallResponseItem(string code) : base(InternalItemType.Code Argument.AssertNotNull(code, nameof(code)); Code = code; - Outputs = new ChangeTrackingList(); + Outputs = new ChangeTrackingList(); } - internal CodeInterpreterCallResponseItem(InternalItemType kind, string id, IDictionary additionalBinaryDataProperties, CodeInterpreterCallStatus? status, string containerId, string code, IList outputs) : base(kind, id, additionalBinaryDataProperties) + internal CodeInterpreterCallResponseItem(InternalItemType kind, string id, IDictionary additionalBinaryDataProperties, CodeInterpreterCallStatus? status, string containerId, string code, IList outputs) : base(kind, id, additionalBinaryDataProperties) { // Plugin customization: ensure initialization of collections Status = status; ContainerId = containerId; Code = code; - Outputs = outputs ?? new ChangeTrackingList(); + Outputs = outputs ?? new ChangeTrackingList(); } public string ContainerId { get; set; } public string Code { get; set; } - public IList Outputs { get; } + public IList Outputs { get; } } } diff --git a/src/Generated/Models/Responses/CodeInterpreterContainer.Serialization.cs b/src/Generated/Models/Responses/CodeInterpreterContainer.Serialization.cs deleted file mode 100644 index 1e09a04a5..000000000 --- a/src/Generated/Models/Responses/CodeInterpreterContainer.Serialization.cs +++ /dev/null @@ -1,138 +0,0 @@ -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using OpenAI; - -namespace OpenAI.Responses -{ - public partial class CodeInterpreterContainer : IJsonModel - { - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(CodeInterpreterContainer)} does not support writing '{format}' format."); - } - if (Optional.IsDefined(ContainerId) && _additionalBinaryDataProperties?.ContainsKey("container_id") != true) - { - writer.WritePropertyName("container_id"u8); - writer.WriteStringValue(ContainerId); - } - if (Optional.IsDefined(Container) && _additionalBinaryDataProperties?.ContainsKey("container") != true) - { - writer.WritePropertyName("container"u8); - writer.WriteObjectValue(Container, options); - } - // Plugin customization: remove options.Format != "W" check - if (_additionalBinaryDataProperties != null) - { - foreach (var item in _additionalBinaryDataProperties) - { - if (ModelSerializationExtensions.IsSentinelValue(item.Value)) - { - continue; - } - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - CodeInterpreterContainer IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); - - protected virtual CodeInterpreterContainer JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(CodeInterpreterContainer)} does not support reading '{format}' format."); - } - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeCodeInterpreterContainer(document.RootElement, options); - } - - internal static CodeInterpreterContainer DeserializeCodeInterpreterContainer(JsonElement element, ModelReaderWriterOptions options) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string containerId = default; - CodeInterpreterContainerConfiguration container = default; - IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); - foreach (var prop in element.EnumerateObject()) - { - if (prop.NameEquals("container_id"u8)) - { - containerId = prop.Value.GetString(); - continue; - } - if (prop.NameEquals("container"u8)) - { - if (prop.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - container = CodeInterpreterContainerConfiguration.DeserializeCodeInterpreterContainerConfiguration(prop.Value, options); - continue; - } - // Plugin customization: remove options.Format != "W" check - additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); - } - return new CodeInterpreterContainer(containerId, container, additionalBinaryDataProperties); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); - - protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) - { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, OpenAIContext.Default); - default: - throw new FormatException($"The model {nameof(CodeInterpreterContainer)} does not support writing '{options.Format}' format."); - } - } - - CodeInterpreterContainer IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); - - protected virtual CodeInterpreterContainer PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) - { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - switch (format) - { - case "J": - using (JsonDocument document = JsonDocument.Parse(data)) - { - return DeserializeCodeInterpreterContainer(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(CodeInterpreterContainer)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/src/Generated/Models/Responses/CodeInterpreterTool.Serialization.cs b/src/Generated/Models/Responses/CodeInterpreterTool.Serialization.cs index c6c016d95..373a9620f 100644 --- a/src/Generated/Models/Responses/CodeInterpreterTool.Serialization.cs +++ b/src/Generated/Models/Responses/CodeInterpreterTool.Serialization.cs @@ -4,6 +4,7 @@ using System; using System.ClientModel.Primitives; +using System.Collections.Generic; using System.Text.Json; using OpenAI; @@ -22,6 +23,21 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWri writer.WriteEndObject(); } + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CodeInterpreterTool)} does not support writing '{format}' format."); + } + base.JsonModelWriteCore(writer, options); + if (_additionalBinaryDataProperties?.ContainsKey("container") != true) + { + writer.WritePropertyName("container"u8); + writer.WriteObjectValue(Container, options); + } + } + CodeInterpreterTool IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (CodeInterpreterTool)JsonModelCreateCore(ref reader, options); protected override ResponseTool JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) @@ -35,6 +51,33 @@ protected override ResponseTool JsonModelCreateCore(ref Utf8JsonReader reader, M return DeserializeCodeInterpreterTool(document.RootElement, options); } + internal static CodeInterpreterTool DeserializeCodeInterpreterTool(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + InternalToolType kind = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + CodeInterpreterToolContainer container = default; + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("type"u8)) + { + kind = new InternalToolType(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("container"u8)) + { + container = CodeInterpreterToolContainer.DeserializeCodeInterpreterToolContainer(prop.Value, options); + continue; + } + // Plugin customization: remove options.Format != "W" check + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + return new CodeInterpreterTool(kind, additionalBinaryDataProperties, container); + } + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); protected override BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) diff --git a/src/Generated/Models/Responses/CodeInterpreterTool.cs b/src/Generated/Models/Responses/CodeInterpreterTool.cs index 509da1ea1..2acecf5d5 100644 --- a/src/Generated/Models/Responses/CodeInterpreterTool.cs +++ b/src/Generated/Models/Responses/CodeInterpreterTool.cs @@ -12,14 +12,14 @@ namespace OpenAI.Responses [Experimental("OPENAI001")] public partial class CodeInterpreterTool : ResponseTool { - public CodeInterpreterTool(CodeInterpreterContainer container) : base(InternalToolType.CodeInterpreter) + public CodeInterpreterTool(CodeInterpreterToolContainer container) : base(InternalToolType.CodeInterpreter) { Argument.AssertNotNull(container, nameof(container)); Container = container; } - internal CodeInterpreterTool(InternalToolType kind, IDictionary additionalBinaryDataProperties, CodeInterpreterContainer container) : base(kind, additionalBinaryDataProperties) + internal CodeInterpreterTool(InternalToolType kind, IDictionary additionalBinaryDataProperties, CodeInterpreterToolContainer container) : base(kind, additionalBinaryDataProperties) { Container = container; } diff --git a/src/Generated/Models/Responses/CodeInterpreterToolContainer.Serialization.cs b/src/Generated/Models/Responses/CodeInterpreterToolContainer.Serialization.cs new file mode 100644 index 000000000..7ca40e554 --- /dev/null +++ b/src/Generated/Models/Responses/CodeInterpreterToolContainer.Serialization.cs @@ -0,0 +1,60 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; +using OpenAI; + +namespace OpenAI.Responses +{ + public partial class CodeInterpreterToolContainer : IJsonModel + { + CodeInterpreterToolContainer IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + protected virtual CodeInterpreterToolContainer JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CodeInterpreterToolContainer)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCodeInterpreterToolContainer(document.RootElement, options); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, OpenAIContext.Default); + default: + throw new FormatException($"The model {nameof(CodeInterpreterToolContainer)} does not support writing '{options.Format}' format."); + } + } + + CodeInterpreterToolContainer IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + protected virtual CodeInterpreterToolContainer PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeCodeInterpreterToolContainer(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CodeInterpreterToolContainer)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/src/Generated/Models/Responses/CodeInterpreterContainer.cs b/src/Generated/Models/Responses/CodeInterpreterToolContainer.cs similarity index 62% rename from src/Generated/Models/Responses/CodeInterpreterContainer.cs rename to src/Generated/Models/Responses/CodeInterpreterToolContainer.cs index 31a111286..a13748824 100644 --- a/src/Generated/Models/Responses/CodeInterpreterContainer.cs +++ b/src/Generated/Models/Responses/CodeInterpreterToolContainer.cs @@ -9,21 +9,17 @@ namespace OpenAI.Responses { [Experimental("OPENAI001")] - public partial class CodeInterpreterContainer + public partial class CodeInterpreterToolContainer { private protected IDictionary _additionalBinaryDataProperties; - internal CodeInterpreterContainer(string containerId, CodeInterpreterContainerConfiguration container, IDictionary additionalBinaryDataProperties) + internal CodeInterpreterToolContainer(string containerId, CodeInterpreterToolContainerConfiguration containerConfiguration, IDictionary additionalBinaryDataProperties) { ContainerId = containerId; - Container = container; + ContainerConfiguration = containerConfiguration; _additionalBinaryDataProperties = additionalBinaryDataProperties; } - public string ContainerId { get; set; } - - public CodeInterpreterContainerConfiguration Container { get; set; } - internal IDictionary SerializedAdditionalRawData { get => _additionalBinaryDataProperties; diff --git a/src/Generated/Models/Responses/CodeInterpreterContainerConfiguration.Serialization.cs b/src/Generated/Models/Responses/CodeInterpreterToolContainerConfiguration.Serialization.cs similarity index 55% rename from src/Generated/Models/Responses/CodeInterpreterContainerConfiguration.Serialization.cs rename to src/Generated/Models/Responses/CodeInterpreterToolContainerConfiguration.Serialization.cs index 0c543f46c..cc16fb5ee 100644 --- a/src/Generated/Models/Responses/CodeInterpreterContainerConfiguration.Serialization.cs +++ b/src/Generated/Models/Responses/CodeInterpreterToolContainerConfiguration.Serialization.cs @@ -10,13 +10,13 @@ namespace OpenAI.Responses { [PersistableModelProxy(typeof(InternalUnknownCodeInterpreterContainerConfiguration))] - public partial class CodeInterpreterContainerConfiguration : IJsonModel + public partial class CodeInterpreterToolContainerConfiguration : IJsonModel { - internal CodeInterpreterContainerConfiguration() + internal CodeInterpreterToolContainerConfiguration() { } - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -25,10 +25,10 @@ void IJsonModel.Write(Utf8JsonWriter writ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(CodeInterpreterContainerConfiguration)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(CodeInterpreterToolContainerConfiguration)} does not support writing '{format}' format."); } if (_additionalBinaryDataProperties?.ContainsKey("type") != true) { @@ -57,20 +57,20 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - CodeInterpreterContainerConfiguration IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + CodeInterpreterToolContainerConfiguration IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); - protected virtual CodeInterpreterContainerConfiguration JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + protected virtual CodeInterpreterToolContainerConfiguration JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(CodeInterpreterContainerConfiguration)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(CodeInterpreterToolContainerConfiguration)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeCodeInterpreterContainerConfiguration(document.RootElement, options); + return DeserializeCodeInterpreterToolContainerConfiguration(document.RootElement, options); } - internal static CodeInterpreterContainerConfiguration DeserializeCodeInterpreterContainerConfiguration(JsonElement element, ModelReaderWriterOptions options) + internal static CodeInterpreterToolContainerConfiguration DeserializeCodeInterpreterToolContainerConfiguration(JsonElement element, ModelReaderWriterOptions options) { if (element.ValueKind == JsonValueKind.Null) { @@ -81,43 +81,43 @@ internal static CodeInterpreterContainerConfiguration DeserializeCodeInterpreter switch (discriminator.GetString()) { case "auto": - return AutomaticCodeInterpreterContainerConfiguration.DeserializeAutomaticCodeInterpreterContainerConfiguration(element, options); + return AutomaticCodeInterpreterToolContainerConfiguration.DeserializeAutomaticCodeInterpreterToolContainerConfiguration(element, options); } } return InternalUnknownCodeInterpreterContainerConfiguration.DeserializeInternalUnknownCodeInterpreterContainerConfiguration(element, options); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options, OpenAIContext.Default); default: - throw new FormatException($"The model {nameof(CodeInterpreterContainerConfiguration)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(CodeInterpreterToolContainerConfiguration)} does not support writing '{options.Format}' format."); } } - CodeInterpreterContainerConfiguration IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + CodeInterpreterToolContainerConfiguration IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); - protected virtual CodeInterpreterContainerConfiguration PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + protected virtual CodeInterpreterToolContainerConfiguration PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": using (JsonDocument document = JsonDocument.Parse(data)) { - return DeserializeCodeInterpreterContainerConfiguration(document.RootElement, options); + return DeserializeCodeInterpreterToolContainerConfiguration(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(CodeInterpreterContainerConfiguration)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(CodeInterpreterToolContainerConfiguration)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/src/Generated/Models/Responses/CodeInterpreterContainerConfiguration.cs b/src/Generated/Models/Responses/CodeInterpreterToolContainerConfiguration.cs similarity index 67% rename from src/Generated/Models/Responses/CodeInterpreterContainerConfiguration.cs rename to src/Generated/Models/Responses/CodeInterpreterToolContainerConfiguration.cs index 29b962b4b..b8e4107dc 100644 --- a/src/Generated/Models/Responses/CodeInterpreterContainerConfiguration.cs +++ b/src/Generated/Models/Responses/CodeInterpreterToolContainerConfiguration.cs @@ -9,16 +9,16 @@ namespace OpenAI.Responses { [Experimental("OPENAI001")] - public partial class CodeInterpreterContainerConfiguration + public partial class CodeInterpreterToolContainerConfiguration { private protected IDictionary _additionalBinaryDataProperties; - private protected CodeInterpreterContainerConfiguration(InternalCodeInterpreterContainerConfigurationType kind) + private protected CodeInterpreterToolContainerConfiguration(InternalCodeInterpreterContainerConfigurationType kind) { Kind = kind; } - internal CodeInterpreterContainerConfiguration(InternalCodeInterpreterContainerConfigurationType kind, IDictionary additionalBinaryDataProperties) + internal CodeInterpreterToolContainerConfiguration(InternalCodeInterpreterContainerConfigurationType kind, IDictionary additionalBinaryDataProperties) { Kind = kind; _additionalBinaryDataProperties = additionalBinaryDataProperties; diff --git a/src/Generated/Models/Responses/InternalCodeInterpreterToolCallItemParam.Serialization.cs b/src/Generated/Models/Responses/InternalCodeInterpreterToolCallItemParam.Serialization.cs index 4b279a171..1aee218e8 100644 --- a/src/Generated/Models/Responses/InternalCodeInterpreterToolCallItemParam.Serialization.cs +++ b/src/Generated/Models/Responses/InternalCodeInterpreterToolCallItemParam.Serialization.cs @@ -45,7 +45,7 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri { writer.WritePropertyName("outputs"u8); writer.WriteStartArray(); - foreach (CodeInterpreterToolOutput item in Outputs) + foreach (CodeInterpreterCallOutput item in Outputs) { writer.WriteObjectValue(item, options); } @@ -76,7 +76,7 @@ internal static InternalCodeInterpreterToolCallItemParam DeserializeInternalCode IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); string containerId = default; string code = default; - IList outputs = default; + IList outputs = default; foreach (var prop in element.EnumerateObject()) { if (prop.NameEquals("type"u8)) @@ -100,10 +100,10 @@ internal static InternalCodeInterpreterToolCallItemParam DeserializeInternalCode { continue; } - List array = new List(); + List array = new List(); foreach (var item in prop.Value.EnumerateArray()) { - array.Add(CodeInterpreterToolOutput.DeserializeCodeInterpreterToolOutput(item, options)); + array.Add(CodeInterpreterCallOutput.DeserializeCodeInterpreterCallOutput(item, options)); } outputs = array; continue; @@ -111,7 +111,7 @@ internal static InternalCodeInterpreterToolCallItemParam DeserializeInternalCode // Plugin customization: remove options.Format != "W" check additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } - return new InternalCodeInterpreterToolCallItemParam(kind, additionalBinaryDataProperties, containerId, code, outputs ?? new ChangeTrackingList()); + return new InternalCodeInterpreterToolCallItemParam(kind, additionalBinaryDataProperties, containerId, code, outputs ?? new ChangeTrackingList()); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); diff --git a/src/Generated/Models/Responses/InternalCodeInterpreterToolCallItemParam.cs b/src/Generated/Models/Responses/InternalCodeInterpreterToolCallItemParam.cs index 1c346381f..ec250d2be 100644 --- a/src/Generated/Models/Responses/InternalCodeInterpreterToolCallItemParam.cs +++ b/src/Generated/Models/Responses/InternalCodeInterpreterToolCallItemParam.cs @@ -15,21 +15,21 @@ public InternalCodeInterpreterToolCallItemParam(string code) : base(InternalItem Argument.AssertNotNull(code, nameof(code)); Code = code; - Outputs = new ChangeTrackingList(); + Outputs = new ChangeTrackingList(); } - internal InternalCodeInterpreterToolCallItemParam(InternalItemType kind, IDictionary additionalBinaryDataProperties, string containerId, string code, IList outputs) : base(kind, additionalBinaryDataProperties) + internal InternalCodeInterpreterToolCallItemParam(InternalItemType kind, IDictionary additionalBinaryDataProperties, string containerId, string code, IList outputs) : base(kind, additionalBinaryDataProperties) { // Plugin customization: ensure initialization of collections ContainerId = containerId; Code = code; - Outputs = outputs ?? new ChangeTrackingList(); + Outputs = outputs ?? new ChangeTrackingList(); } public string ContainerId { get; set; } public string Code { get; } - public IList Outputs { get; } + public IList Outputs { get; } } } diff --git a/src/Generated/Models/Responses/InternalUnknownCodeInterpreterContainerConfiguration.Serialization.cs b/src/Generated/Models/Responses/InternalUnknownCodeInterpreterContainerConfiguration.Serialization.cs index 8cafb55ce..e7ef2fc9c 100644 --- a/src/Generated/Models/Responses/InternalUnknownCodeInterpreterContainerConfiguration.Serialization.cs +++ b/src/Generated/Models/Responses/InternalUnknownCodeInterpreterContainerConfiguration.Serialization.cs @@ -10,13 +10,13 @@ namespace OpenAI.Responses { - internal partial class InternalUnknownCodeInterpreterContainerConfiguration : IJsonModel + internal partial class InternalUnknownCodeInterpreterContainerConfiguration : IJsonModel { internal InternalUnknownCodeInterpreterContainerConfiguration() : this(default, null) { } - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -25,25 +25,25 @@ void IJsonModel.Write(Utf8JsonWriter writ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(CodeInterpreterContainerConfiguration)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(CodeInterpreterToolContainerConfiguration)} does not support writing '{format}' format."); } base.JsonModelWriteCore(writer, options); } - CodeInterpreterContainerConfiguration IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + CodeInterpreterToolContainerConfiguration IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); - protected override CodeInterpreterContainerConfiguration JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + protected override CodeInterpreterToolContainerConfiguration JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(CodeInterpreterContainerConfiguration)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(CodeInterpreterToolContainerConfiguration)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeCodeInterpreterContainerConfiguration(document.RootElement, options); + return DeserializeCodeInterpreterToolContainerConfiguration(document.RootElement, options); } internal static InternalUnknownCodeInterpreterContainerConfiguration DeserializeInternalUnknownCodeInterpreterContainerConfiguration(JsonElement element, ModelReaderWriterOptions options) @@ -67,37 +67,37 @@ internal static InternalUnknownCodeInterpreterContainerConfiguration Deserialize return new InternalUnknownCodeInterpreterContainerConfiguration(kind, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); protected override BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options, OpenAIContext.Default); default: - throw new FormatException($"The model {nameof(CodeInterpreterContainerConfiguration)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(CodeInterpreterToolContainerConfiguration)} does not support writing '{options.Format}' format."); } } - CodeInterpreterContainerConfiguration IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + CodeInterpreterToolContainerConfiguration IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); - protected override CodeInterpreterContainerConfiguration PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + protected override CodeInterpreterToolContainerConfiguration PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": using (JsonDocument document = JsonDocument.Parse(data)) { - return DeserializeCodeInterpreterContainerConfiguration(document.RootElement, options); + return DeserializeCodeInterpreterToolContainerConfiguration(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(CodeInterpreterContainerConfiguration)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(CodeInterpreterToolContainerConfiguration)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/src/Generated/Models/Responses/InternalUnknownCodeInterpreterContainerConfiguration.cs b/src/Generated/Models/Responses/InternalUnknownCodeInterpreterContainerConfiguration.cs index 876562194..972d963b8 100644 --- a/src/Generated/Models/Responses/InternalUnknownCodeInterpreterContainerConfiguration.cs +++ b/src/Generated/Models/Responses/InternalUnknownCodeInterpreterContainerConfiguration.cs @@ -7,7 +7,7 @@ namespace OpenAI.Responses { - internal partial class InternalUnknownCodeInterpreterContainerConfiguration : CodeInterpreterContainerConfiguration + internal partial class InternalUnknownCodeInterpreterContainerConfiguration : CodeInterpreterToolContainerConfiguration { internal InternalUnknownCodeInterpreterContainerConfiguration(InternalCodeInterpreterContainerConfigurationType kind, IDictionary additionalBinaryDataProperties) : base(kind != default ? kind : "unknown", additionalBinaryDataProperties) { diff --git a/src/Generated/Models/Responses/InternalUnknownCodeInterpreterToolOutput.Serialization.cs b/src/Generated/Models/Responses/InternalUnknownCodeInterpreterToolOutput.Serialization.cs index 3424829b7..34b477156 100644 --- a/src/Generated/Models/Responses/InternalUnknownCodeInterpreterToolOutput.Serialization.cs +++ b/src/Generated/Models/Responses/InternalUnknownCodeInterpreterToolOutput.Serialization.cs @@ -10,13 +10,13 @@ namespace OpenAI.Responses { - internal partial class InternalUnknownCodeInterpreterToolOutput : IJsonModel + internal partial class InternalUnknownCodeInterpreterToolOutput : IJsonModel { internal InternalUnknownCodeInterpreterToolOutput() : this(default, null) { } - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -25,25 +25,25 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRea protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(CodeInterpreterToolOutput)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(CodeInterpreterCallOutput)} does not support writing '{format}' format."); } base.JsonModelWriteCore(writer, options); } - CodeInterpreterToolOutput IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + CodeInterpreterCallOutput IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); - protected override CodeInterpreterToolOutput JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + protected override CodeInterpreterCallOutput JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(CodeInterpreterToolOutput)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(CodeInterpreterCallOutput)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeCodeInterpreterToolOutput(document.RootElement, options); + return DeserializeCodeInterpreterCallOutput(document.RootElement, options); } internal static InternalUnknownCodeInterpreterToolOutput DeserializeInternalUnknownCodeInterpreterToolOutput(JsonElement element, ModelReaderWriterOptions options) @@ -67,37 +67,37 @@ internal static InternalUnknownCodeInterpreterToolOutput DeserializeInternalUnkn return new InternalUnknownCodeInterpreterToolOutput(kind, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); protected override BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options, OpenAIContext.Default); default: - throw new FormatException($"The model {nameof(CodeInterpreterToolOutput)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(CodeInterpreterCallOutput)} does not support writing '{options.Format}' format."); } } - CodeInterpreterToolOutput IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + CodeInterpreterCallOutput IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); - protected override CodeInterpreterToolOutput PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + protected override CodeInterpreterCallOutput PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": using (JsonDocument document = JsonDocument.Parse(data)) { - return DeserializeCodeInterpreterToolOutput(document.RootElement, options); + return DeserializeCodeInterpreterCallOutput(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(CodeInterpreterToolOutput)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(CodeInterpreterCallOutput)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/src/Generated/Models/Responses/InternalUnknownCodeInterpreterToolOutput.cs b/src/Generated/Models/Responses/InternalUnknownCodeInterpreterToolOutput.cs index fa7c3bbb0..8899a6b7b 100644 --- a/src/Generated/Models/Responses/InternalUnknownCodeInterpreterToolOutput.cs +++ b/src/Generated/Models/Responses/InternalUnknownCodeInterpreterToolOutput.cs @@ -7,7 +7,7 @@ namespace OpenAI.Responses { - internal partial class InternalUnknownCodeInterpreterToolOutput : CodeInterpreterToolOutput + internal partial class InternalUnknownCodeInterpreterToolOutput : CodeInterpreterCallOutput { internal InternalUnknownCodeInterpreterToolOutput(InternalCodeInterpreterToolOutputType kind, IDictionary additionalBinaryDataProperties) : base(kind != default ? kind : "unknown", additionalBinaryDataProperties) { diff --git a/src/Generated/OpenAIModelFactory.cs b/src/Generated/OpenAIModelFactory.cs index 97bd326db..d217aabcc 100644 --- a/src/Generated/OpenAIModelFactory.cs +++ b/src/Generated/OpenAIModelFactory.cs @@ -1331,9 +1331,9 @@ public static McpToolCallApprovalPolicy McpToolCallApprovalPolicy(GlobalMcpToolC return new McpToolCallApprovalPolicy(globalPolicy, customPolicy, additionalBinaryDataProperties: null); } - public static CodeInterpreterContainer CodeInterpreterContainer(string containerId = default, CodeInterpreterContainerConfiguration container = default) + public static CodeInterpreterToolContainer CodeInterpreterToolContainer(string containerId = default, CodeInterpreterToolContainerConfiguration containerConfiguration = default) { - return new CodeInterpreterContainer(containerId, container, additionalBinaryDataProperties: null); + return new CodeInterpreterToolContainer(containerId, containerConfiguration, additionalBinaryDataProperties: null); } public static VectorStoreCollectionOptions VectorStoreCollectionOptions(string afterId = default, string beforeId = default, int? pageSizeLimit = default, VectorStoreCollectionOrder? order = default) diff --git a/src/OpenAI.csproj b/src/OpenAI.csproj index f269152bb..25c0990fb 100644 --- a/src/OpenAI.csproj +++ b/src/OpenAI.csproj @@ -8,7 +8,7 @@ MIT Copyright (c) 2024 OpenAI (https://openai.com) - 2.4.0 + 2.5.0 net8.0;netstandard2.0 diff --git a/tests/Responses/ResponsesSmokeTests.cs b/tests/Responses/ResponsesSmokeTests.cs index b9a8310b0..fa3af930a 100644 --- a/tests/Responses/ResponsesSmokeTests.cs +++ b/tests/Responses/ResponsesSmokeTests.cs @@ -295,4 +295,91 @@ public void SerializeMCPToolCallApprovalPolicyAsObject(bool fromRawJson) Assert.That(additionalPropertyProperty.ValueKind, Is.EqualTo(JsonValueKind.True)); } } + + [Test] + [TestCase(true)] + [TestCase(false)] + public void SerializeCodeInterpreterToolContainerAsString(bool fromRawJson) + { + CodeInterpreterToolContainer container; + string containerId = "myContainerId"; + + if (fromRawJson) + { + BinaryData data = BinaryData.FromString($"\"{ containerId }\""); + + // We deserialize the raw JSON. Later, we serialize it back and confirm nothing was lost in the process. + container = ModelReaderWriter.Read(data); + } + else + { + // We construct a new instance. Later, we serialize it and confirm it was constructed correctly. + container = new CodeInterpreterToolContainer(containerId); + } + + BinaryData serializedContainer = ModelReaderWriter.Write(container); + using JsonDocument containerAsJson = JsonDocument.Parse(serializedContainer); + Assert.That(containerAsJson.RootElement, Is.Not.Null); + Assert.That(containerAsJson.RootElement.ValueKind, Is.EqualTo(JsonValueKind.String)); + Assert.That(containerAsJson.RootElement.ToString(), Is.EqualTo(containerId)); + } + + [Test] + [TestCase(true)] + [TestCase(false)] + public void SerializeCodeInterpreterToolContainerAsObject(bool fromRawJson) + { + const string fileId = "myFileId"; + + CodeInterpreterToolContainer container; + + if (fromRawJson) + { + BinaryData data = BinaryData.FromString($$""" + { + "type": "auto", + "file_ids": ["{{fileId}}"], + "additional_property": true + } + """); + + // We deserialize the raw JSON. Later, we serialize it back and confirm nothing was lost in the process. + container = ModelReaderWriter.Read(data); + } + else + { + // We construct a new instance. Later, we serialize it and confirm it was constructed correctly. + AutomaticCodeInterpreterToolContainerConfiguration autoConfig = new() + { + FileIds = { fileId } + }; + + container = new CodeInterpreterToolContainer(autoConfig); + } + + BinaryData serializedContainer = ModelReaderWriter.Write(container); + using JsonDocument containerAsJson = JsonDocument.Parse(serializedContainer); + Assert.That(containerAsJson.RootElement, Is.Not.Null); + Assert.That(containerAsJson.RootElement.ValueKind, Is.EqualTo(JsonValueKind.Object)); + + Assert.That(containerAsJson.RootElement.TryGetProperty("type", out JsonElement typeProperty), Is.True); + Assert.That(typeProperty, Is.Not.Null); + Assert.That(typeProperty.ValueKind, Is.EqualTo(JsonValueKind.String)); + Assert.That(typeProperty.ToString(), Is.EqualTo("auto")); + + Assert.That(containerAsJson.RootElement.TryGetProperty("file_ids", out JsonElement fileIdsProperty), Is.True); + Assert.That(fileIdsProperty, Is.Not.Null); + Assert.That(fileIdsProperty.ValueKind, Is.EqualTo(JsonValueKind.Array)); + Assert.That(fileIdsProperty.EnumerateArray().FirstOrDefault(), Is.Not.Null); + Assert.That(fileIdsProperty.EnumerateArray().FirstOrDefault().ValueKind, Is.EqualTo(JsonValueKind.String)); + Assert.That(fileIdsProperty.EnumerateArray().FirstOrDefault().ToString(), Is.EqualTo(fileId)); + + if (fromRawJson) + { + // Confirm that we also have the additional data. + Assert.That(containerAsJson.RootElement.TryGetProperty("additional_property", out JsonElement additionalPropertyProperty), Is.True); + Assert.That(additionalPropertyProperty, Is.Not.Null); + Assert.That(additionalPropertyProperty.ValueKind, Is.EqualTo(JsonValueKind.True)); + } + } } \ No newline at end of file diff --git a/tests/Responses/ResponsesToolTests.cs b/tests/Responses/ResponsesToolTests.cs index 1732c904d..9f9d4797c 100644 --- a/tests/Responses/ResponsesToolTests.cs +++ b/tests/Responses/ResponsesToolTests.cs @@ -403,7 +403,7 @@ public async Task CodeInterpreterToolWithoutFileIds() { OpenAIResponseClient client = GetTestClient(); - ResponseTool codeInterpreterTool = ResponseTool.CreateCodeInterpreterTool(new CodeInterpreterContainer(new AutomaticCodeInterpreterContainerConfiguration())); + ResponseTool codeInterpreterTool = ResponseTool.CreateCodeInterpreterTool(new CodeInterpreterToolContainer(new AutomaticCodeInterpreterToolContainerConfiguration())); ResponseCreationOptions responseOptions = new() { Tools = { codeInterpreterTool }, @@ -434,7 +434,7 @@ public async Task CodeInterpreterToolWithEmptyFileIds() { OpenAIResponseClient client = GetTestClient(); - ResponseTool codeInterpreterTool = ResponseTool.CreateCodeInterpreterTool(new(new AutomaticCodeInterpreterContainerConfiguration(new List()))); + ResponseTool codeInterpreterTool = ResponseTool.CreateCodeInterpreterTool(new(new AutomaticCodeInterpreterToolContainerConfiguration())); ResponseCreationOptions responseOptions = new() { Tools = { codeInterpreterTool }, @@ -544,7 +544,7 @@ public async Task CodeInterpreterToolWithUploadedFileIds() fileIds.Add(pythonFile.Id); // Create CodeInterpreter tool with uploaded file IDs - ResponseTool codeInterpreterTool = ResponseTool.CreateCodeInterpreterTool(new(new AutomaticCodeInterpreterContainerConfiguration(fileIds))); + ResponseTool codeInterpreterTool = ResponseTool.CreateCodeInterpreterTool(new(CodeInterpreterToolContainerConfiguration.CreateAutomaticContainerConfiguration(fileIds))); ResponseCreationOptions responseOptions = new() { Tools = { codeInterpreterTool }, @@ -585,7 +585,7 @@ public async Task CodeInterpreterToolStreaming() { OpenAIResponseClient client = GetTestClient(); - ResponseTool codeInterpreterTool = ResponseTool.CreateCodeInterpreterTool(new CodeInterpreterContainer(new AutomaticCodeInterpreterContainerConfiguration())); + ResponseTool codeInterpreterTool = ResponseTool.CreateCodeInterpreterTool(new CodeInterpreterToolContainer(new AutomaticCodeInterpreterToolContainerConfiguration())); ResponseCreationOptions responseOptions = new() { Tools = { codeInterpreterTool }, @@ -634,7 +634,7 @@ public async Task CodeInterpreterToolStreamingWithFiles() fileIds.Add(csvFile.Id); // Create CodeInterpreter tool with uploaded file IDs - ResponseTool codeInterpreterTool = ResponseTool.CreateCodeInterpreterTool(new CodeInterpreterContainer(new AutomaticCodeInterpreterContainerConfiguration(fileIds))); + ResponseTool codeInterpreterTool = ResponseTool.CreateCodeInterpreterTool(new CodeInterpreterToolContainer(CodeInterpreterToolContainerConfiguration.CreateAutomaticContainerConfiguration(fileIds))); ResponseCreationOptions responseOptions = new() { Tools = { codeInterpreterTool }, diff --git a/tspCodeModel.json b/tspCodeModel.json index f4d734fca..2aa1e2c9f 100644 --- a/tspCodeModel.json +++ b/tspCodeModel.json @@ -97900,9 +97900,9 @@ { "$id": "7483", "kind": "model", - "name": "DotNetCodeInterpreterContainer", + "name": "DotNetCodeInterpreterToolContainer", "namespace": "OpenAI", - "crossLanguageDefinitionId": "OpenAI.DotNetCodeInterpreterContainer", + "crossLanguageDefinitionId": "OpenAI.DotNetCodeInterpreterToolContainer", "access": "public", "usage": "Input,Output", "decorators": [], @@ -97923,7 +97923,7 @@ "discriminator": false, "flatten": false, "decorators": [], - "crossLanguageDefinitionId": "OpenAI.DotNetCodeInterpreterContainer.container_id", + "crossLanguageDefinitionId": "OpenAI.DotNetCodeInterpreterToolContainer.container_id", "serializationOptions": {}, "isHttpMetadata": false }, @@ -97939,7 +97939,7 @@ "discriminator": false, "flatten": false, "decorators": [], - "crossLanguageDefinitionId": "OpenAI.DotNetCodeInterpreterContainer.container", + "crossLanguageDefinitionId": "OpenAI.DotNetCodeInterpreterToolContainer.container", "serializationOptions": {}, "isHttpMetadata": false }