diff --git a/api/OpenAI.net10.0.cs b/api/OpenAI.net10.0.cs index 72a1a129e..2cc52840a 100644 --- a/api/OpenAI.net10.0.cs +++ b/api/OpenAI.net10.0.cs @@ -5026,6 +5026,8 @@ public class CodeInterpreterToolContainer : IJsonModel [CodeGenType("DotNetCodeInterpreterToolContainer")] +[CodeGenVisibility(nameof(CodeInterpreterToolContainer), CodeGenVisibility.Internal)] 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. @@ -23,6 +19,8 @@ internal CodeInterpreterToolContainer() /// The ID of the container. public CodeInterpreterToolContainer(string containerId) { + Argument.AssertNotNull(containerId, nameof(containerId)); + ContainerId = containerId; } @@ -33,6 +31,8 @@ public CodeInterpreterToolContainer(string containerId) /// The configuration of the container. public CodeInterpreterToolContainer(CodeInterpreterToolContainerConfiguration containerConfiguration) { + Argument.AssertNotNull(containerConfiguration, nameof(containerConfiguration)); + ContainerConfiguration = containerConfiguration; } @@ -45,4 +45,10 @@ public CodeInterpreterToolContainer(CodeInterpreterToolContainerConfiguration co // - Removed setter. [CodeGenMember("Container")] public CodeInterpreterToolContainerConfiguration ContainerConfiguration { get; } + + // CUSTOM: Added for convenience. + public static implicit operator CodeInterpreterToolContainer(string containerId) => containerId is null ? null : new(containerId); + + // CUSTOM: Added for convenience. + public static implicit operator CodeInterpreterToolContainer(CodeInterpreterToolContainerConfiguration containerConfiguration) => containerConfiguration is null ? null : new(containerConfiguration); } \ 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 7ac182230..903783de8 100644 --- a/src/Custom/Responses/Tools/McpTool/McpToolCallApprovalPolicy.cs +++ b/src/Custom/Responses/Tools/McpTool/McpToolCallApprovalPolicy.cs @@ -34,5 +34,5 @@ public McpToolCallApprovalPolicy(CustomMcpToolCallApprovalPolicy customPolicy) public static implicit operator McpToolCallApprovalPolicy(GlobalMcpToolCallApprovalPolicy globalPolicy) => new(globalPolicy); // CUSTOM: Added for convenience. - public static implicit operator McpToolCallApprovalPolicy(CustomMcpToolCallApprovalPolicy customPolicy) => new(customPolicy); + public static implicit operator McpToolCallApprovalPolicy(CustomMcpToolCallApprovalPolicy customPolicy) => customPolicy is null ? null : new(customPolicy); } diff --git a/src/Generated/Models/Responses/CodeInterpreterToolContainer.cs b/src/Generated/Models/Responses/CodeInterpreterToolContainer.cs index 252af418d..15428b06d 100644 --- a/src/Generated/Models/Responses/CodeInterpreterToolContainer.cs +++ b/src/Generated/Models/Responses/CodeInterpreterToolContainer.cs @@ -15,6 +15,10 @@ public partial class CodeInterpreterToolContainer [Experimental("SCME0001")] private JsonPatch _patch; + internal CodeInterpreterToolContainer() + { + } + #pragma warning disable SCME0001 // Type is for evaluation purposes only and is subject to change or removal in future updates. internal CodeInterpreterToolContainer(string containerId, CodeInterpreterToolContainerConfiguration containerConfiguration, in JsonPatch patch) { diff --git a/tests/Responses/ResponsesSmokeTests.cs b/tests/Responses/ResponsesSmokeTests.cs index 918d06200..08f6afc3d 100644 --- a/tests/Responses/ResponsesSmokeTests.cs +++ b/tests/Responses/ResponsesSmokeTests.cs @@ -507,7 +507,7 @@ public void SerializeCodeInterpreterToolContainerAsString(bool fromRawJson) else { // We construct a new instance. Later, we serialize it and confirm it was constructed correctly. - container = new CodeInterpreterToolContainer(containerId); + container = containerId; } BinaryData serializedContainer = ModelReaderWriter.Write(container); @@ -542,12 +542,10 @@ public void SerializeCodeInterpreterToolContainerAsObject(bool fromRawJson) else { // We construct a new instance. Later, we serialize it and confirm it was constructed correctly. - AutomaticCodeInterpreterToolContainerConfiguration autoConfig = new() + container = new AutomaticCodeInterpreterToolContainerConfiguration() { FileIds = { fileId } }; - - container = new CodeInterpreterToolContainer(autoConfig); } BinaryData serializedContainer = ModelReaderWriter.Write(container);