Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion api/OpenAI.net8.0.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1213,6 +1213,8 @@ public class AudioTranslation : IJsonModel<AudioTranslation>, IPersistableModel<
[Experimental("OPENAI001")]
protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options);
[Experimental("OPENAI001")]
public static explicit operator AudioTranslation(ClientResult result);
[Experimental("OPENAI001")]
protected virtual AudioTranslation PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options);
[Experimental("OPENAI001")]
protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options);
Expand Down Expand Up @@ -1342,6 +1344,7 @@ public class StreamingAudioTranscriptionTextDoneUpdate : StreamingAudioTranscrip
public class StreamingAudioTranscriptionUpdate : IJsonModel<StreamingAudioTranscriptionUpdate>, IPersistableModel<StreamingAudioTranscriptionUpdate> {
protected virtual StreamingAudioTranscriptionUpdate JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options);
protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options);
public static explicit operator StreamingAudioTranscriptionUpdate(ClientResult result);
protected virtual StreamingAudioTranscriptionUpdate PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options);
protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options);
}
Expand Down Expand Up @@ -2422,7 +2425,6 @@ public class CreateContainerBody : IJsonModel<CreateContainerBody>, IPersistable
[Experimental("OPENAI001")]
public class CreateContainerBodyExpiresAfter : IJsonModel<CreateContainerBodyExpiresAfter>, IPersistableModel<CreateContainerBodyExpiresAfter> {
public CreateContainerBodyExpiresAfter(int minutes);
public string Anchor { get; }
public int Minutes { get; }
protected virtual CreateContainerBodyExpiresAfter JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options);
protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options);
Expand Down
3 changes: 2 additions & 1 deletion api/OpenAI.netstandard2.0.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1097,6 +1097,7 @@ public class AudioTranslation : IJsonModel<AudioTranslation>, IPersistableModel<
public string Text { get; }
protected virtual AudioTranslation JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options);
protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options);
public static explicit operator AudioTranslation(ClientResult result);
protected virtual AudioTranslation PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options);
protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options);
}
Expand Down Expand Up @@ -1207,6 +1208,7 @@ public class StreamingAudioTranscriptionTextDoneUpdate : StreamingAudioTranscrip
public class StreamingAudioTranscriptionUpdate : IJsonModel<StreamingAudioTranscriptionUpdate>, IPersistableModel<StreamingAudioTranscriptionUpdate> {
protected virtual StreamingAudioTranscriptionUpdate JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options);
protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options);
public static explicit operator StreamingAudioTranscriptionUpdate(ClientResult result);
protected virtual StreamingAudioTranscriptionUpdate PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options);
protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options);
}
Expand Down Expand Up @@ -2097,7 +2099,6 @@ public class CreateContainerBody : IJsonModel<CreateContainerBody>, IPersistable
}
public class CreateContainerBodyExpiresAfter : IJsonModel<CreateContainerBodyExpiresAfter>, IPersistableModel<CreateContainerBodyExpiresAfter> {
public CreateContainerBodyExpiresAfter(int minutes);
public string Anchor { get; }
public int Minutes { get; }
protected virtual CreateContainerBodyExpiresAfter JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options);
protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options);
Expand Down
2 changes: 1 addition & 1 deletion codegen/generator/src/OpenAI.Library.Plugin.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.TypeSpec.Generator.ClientModel" Version="1.0.0-alpha.20251003.2" />
<PackageReference Include="Microsoft.TypeSpec.Generator.ClientModel" Version="1.0.0-alpha.20251009.7" />
</ItemGroup>

<!-- Copy output to package dist path for local execution and -->
Expand Down
2 changes: 1 addition & 1 deletion codegen/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"dependencies": {
"@open-ai/plugin": "file:",
"@azure-tools/typespec-client-generator-core": "0.60.0",
"@typespec/http-client-csharp": "1.0.0-alpha.20251003.2",
"@typespec/http-client-csharp": "1.0.0-alpha.20251009.7",
"@typespec/http": "1.4.0",
"@typespec/openapi": "1.4.0"
},
Expand Down
26 changes: 13 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/Custom/Batch/BatchClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ namespace OpenAI.Batch;
/// <summary> The service client for OpenAI batch operations. </summary>
[CodeGenType("Batches")]
[CodeGenSuppress("BatchClient", typeof(ClientPipeline), typeof(Uri))]
[CodeGenSuppress("CreateBatch", typeof(string), typeof(InternalCreateBatchRequestEndpoint), typeof(string), typeof(IDictionary<string, string>), typeof(CancellationToken))]
[CodeGenSuppress("CreateBatchAsync", typeof(string), typeof(InternalCreateBatchRequestEndpoint), typeof(string), typeof(IDictionary<string, string>), typeof(CancellationToken))]
[CodeGenSuppress("CreateBatch", typeof(string), typeof(InternalCreateBatchRequestEndpoint), typeof(IDictionary<string, string>), typeof(CancellationToken))]
[CodeGenSuppress("CreateBatchAsync", typeof(string), typeof(InternalCreateBatchRequestEndpoint), typeof(IDictionary<string, string>), typeof(CancellationToken))]
[CodeGenSuppress("CreateBatch", typeof(BinaryContent), typeof(RequestOptions))]
[CodeGenSuppress("CreateBatchAsync", typeof(BinaryContent), typeof(RequestOptions))]
[CodeGenSuppress("GetBatch", typeof(string), typeof(CancellationToken))]
Expand Down
7 changes: 7 additions & 0 deletions src/Custom/Containers/ContainerResourceExpiresAfter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace OpenAI.Containers;

public partial class ContainerResourceExpiresAfter
{
// CUSTOM: Convert to a string for back compatibility.
public string Anchor { get; }
}
1 change: 1 addition & 0 deletions src/Custom/Containers/internal/GeneratorStubs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@

[CodeGenType("ContainerListResource")] internal partial class InternalContainerListResource { }
[CodeGenType("ContainerFileListResource")] internal partial class InternalContainerFileListResource { }
[CodeGenType("ContainerResourceExpiresAfterAnchor")] internal partial struct InternalContainerResourceExpiresAfterAnchor { }
1 change: 1 addition & 0 deletions src/Custom/Responses/Internal/GeneratorStubs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ namespace OpenAI.Responses;
[CodeGenType("LogProb")] internal partial class InternalLogProb {}
[CodeGenType("TopLogProb")] internal partial class InternalTopLogProb {}
[CodeGenType("ImageGenToolCallItemParam")] internal partial class InternalImageGenToolCallItemParam {}
[CodeGenType("ImageGenToolModel")] internal partial struct InternalImageGenToolModel { }
[CodeGenType("CodeInterpreterToolCallItemParam")] internal partial class InternalCodeInterpreterToolCallItemParam {}
[CodeGenType("LocalShellToolCallItemParam")] internal partial class InternalLocalShellToolCallItemParam {}
[CodeGenType("LocalShellExecAction")] internal partial class InternalLocalShellExecAction {}
Expand Down
3 changes: 3 additions & 0 deletions src/Custom/Responses/Tools/ImageGenerationTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,7 @@ public partial class ImageGenerationTool
// CUSTOM:Renamed.
[CodeGenMember("PartialImages")]
public int? PartialImageCount { get; set; }

// CUSTOM: Convert to string to ensure backwards compatibility.
public string Model { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ public partial class RunStepFileSearchResultContent
{
private protected IDictionary<string, BinaryData> _additionalBinaryDataProperties;

internal RunStepFileSearchResultContent(RunStepFileSearchResultContentKind kind, string text)
internal RunStepFileSearchResultContent(string text)
{
Kind = kind;
Text = text;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit
if (Optional.IsDefined(Object) && _additionalBinaryDataProperties?.ContainsKey("object") != true)
{
writer.WritePropertyName("object"u8);
writer.WriteStringValue(Object);
writer.WriteStringValue(Object.Value.ToString());
}
if (Optional.IsCollectionDefined(Data) && _additionalBinaryDataProperties?.ContainsKey("data") != true)
{
Expand Down Expand Up @@ -82,14 +82,18 @@ internal static InternalBatchErrors DeserializeInternalBatchErrors(JsonElement e
{
return null;
}
string @object = default;
InternalBatchErrorsObject? @object = default;
IList<InternalBatchError> data = default;
IDictionary<string, BinaryData> additionalBinaryDataProperties = new ChangeTrackingDictionary<string, BinaryData>();
foreach (var prop in element.EnumerateObject())
{
if (prop.NameEquals("object"u8))
{
@object = prop.Value.GetString();
if (prop.Value.ValueKind == JsonValueKind.Null)
{
continue;
}
@object = new InternalBatchErrorsObject(prop.Value.GetString());
continue;
}
if (prop.NameEquals("data"u8))
Expand Down
6 changes: 3 additions & 3 deletions src/Generated/Models/Batch/InternalBatchErrors.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ internal partial class InternalBatchErrors
{
private protected IDictionary<string, BinaryData> _additionalBinaryDataProperties;

internal InternalBatchErrors() : this(null, null, null)
internal InternalBatchErrors() : this(default, null, null)
{
}

internal InternalBatchErrors(string @object, IList<InternalBatchError> data, IDictionary<string, BinaryData> additionalBinaryDataProperties)
internal InternalBatchErrors(InternalBatchErrorsObject? @object, IList<InternalBatchError> data, IDictionary<string, BinaryData> additionalBinaryDataProperties)
{
// Plugin customization: ensure initialization of collections
Object = @object;
Data = data ?? new ChangeTrackingList<InternalBatchError>();
_additionalBinaryDataProperties = additionalBinaryDataProperties;
}

public string Object { get; }
internal InternalBatchErrorsObject? Object { get; }

internal IList<InternalBatchError> Data { get; }

Expand Down
43 changes: 43 additions & 0 deletions src/Generated/Models/Batch/InternalBatchErrorsObject.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// <auto-generated/>

#nullable disable

using System;
using System.ComponentModel;
using OpenAI;

namespace OpenAI.Batch
{
internal readonly partial struct InternalBatchErrorsObject : IEquatable<InternalBatchErrorsObject>
{
private readonly string _value;
private const string ListValue = "list";

public InternalBatchErrorsObject(string value)
{
Argument.AssertNotNull(value, nameof(value));

_value = value;
}

internal static InternalBatchErrorsObject List { get; } = new InternalBatchErrorsObject(ListValue);

public static bool operator ==(InternalBatchErrorsObject left, InternalBatchErrorsObject right) => left.Equals(right);

public static bool operator !=(InternalBatchErrorsObject left, InternalBatchErrorsObject right) => !left.Equals(right);

public static implicit operator InternalBatchErrorsObject(string value) => new InternalBatchErrorsObject(value);

public static implicit operator InternalBatchErrorsObject?(string value) => value == null ? null : new InternalBatchErrorsObject(value);

[EditorBrowsable(EditorBrowsableState.Never)]
public override bool Equals(object obj) => obj is InternalBatchErrorsObject other && Equals(other);

public bool Equals(InternalBatchErrorsObject other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase);

[EditorBrowsable(EditorBrowsableState.Never)]
public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0;

public override string ToString() => _value;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit
if (Optional.IsDefined(Method) && _additionalBinaryDataProperties?.ContainsKey("method") != true)
{
writer.WritePropertyName("method"u8);
writer.WriteStringValue(Method);
writer.WriteStringValue(Method.Value.ToString());
}
if (Optional.IsDefined(Url) && _additionalBinaryDataProperties?.ContainsKey("url") != true)
{
Expand Down Expand Up @@ -83,7 +83,7 @@ internal static InternalBatchRequestInput DeserializeInternalBatchRequestInput(J
return null;
}
string customId = default;
string @method = default;
InternalBatchRequestInputMethod? @method = default;
Uri url = default;
IDictionary<string, BinaryData> additionalBinaryDataProperties = new ChangeTrackingDictionary<string, BinaryData>();
foreach (var prop in element.EnumerateObject())
Expand All @@ -95,7 +95,11 @@ internal static InternalBatchRequestInput DeserializeInternalBatchRequestInput(J
}
if (prop.NameEquals("method"u8))
{
@method = prop.Value.GetString();
if (prop.Value.ValueKind == JsonValueKind.Null)
{
continue;
}
@method = new InternalBatchRequestInputMethod(prop.Value.GetString());
continue;
}
if (prop.NameEquals("url"u8))
Expand Down
4 changes: 2 additions & 2 deletions src/Generated/Models/Batch/InternalBatchRequestInput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public InternalBatchRequestInput()
{
}

internal InternalBatchRequestInput(string customId, string @method, Uri url, IDictionary<string, BinaryData> additionalBinaryDataProperties)
internal InternalBatchRequestInput(string customId, InternalBatchRequestInputMethod? @method, Uri url, IDictionary<string, BinaryData> additionalBinaryDataProperties)
{
CustomId = customId;
Method = @method;
Expand All @@ -25,7 +25,7 @@ internal InternalBatchRequestInput(string customId, string @method, Uri url, IDi

public string CustomId { get; set; }

public string Method { get; set; }
internal InternalBatchRequestInputMethod? Method { get; set; }

public Uri Url { get; set; }

Expand Down
43 changes: 43 additions & 0 deletions src/Generated/Models/Batch/InternalBatchRequestInputMethod.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// <auto-generated/>

#nullable disable

using System;
using System.ComponentModel;
using OpenAI;

namespace OpenAI.Batch
{
internal readonly partial struct InternalBatchRequestInputMethod : IEquatable<InternalBatchRequestInputMethod>
{
private readonly string _value;
private const string POSTValue = "POST";

public InternalBatchRequestInputMethod(string value)
{
Argument.AssertNotNull(value, nameof(value));

_value = value;
}

internal static InternalBatchRequestInputMethod POST { get; } = new InternalBatchRequestInputMethod(POSTValue);

public static bool operator ==(InternalBatchRequestInputMethod left, InternalBatchRequestInputMethod right) => left.Equals(right);

public static bool operator !=(InternalBatchRequestInputMethod left, InternalBatchRequestInputMethod right) => !left.Equals(right);

public static implicit operator InternalBatchRequestInputMethod(string value) => new InternalBatchRequestInputMethod(value);

public static implicit operator InternalBatchRequestInputMethod?(string value) => value == null ? null : new InternalBatchRequestInputMethod(value);

[EditorBrowsable(EditorBrowsableState.Never)]
public override bool Equals(object obj) => obj is InternalBatchRequestInputMethod other && Equals(other);

public bool Equals(InternalBatchRequestInputMethod other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase);

[EditorBrowsable(EditorBrowsableState.Never)]
public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0;

public override string ToString() => _value;
}
}
2 changes: 1 addition & 1 deletion src/Generated/Models/Batch/InternalCreateBatchRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ internal InternalCreateBatchRequest(string inputFileId, InternalCreateBatchReque

internal InternalCreateBatchRequestEndpoint Endpoint { get; }

public string CompletionWindow { get; } = "24h";
internal string CompletionWindow { get; } = "24h";

public IDictionary<string, string> Metadata { get; }

Expand Down
Loading