Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
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.1" />
<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.1",
"@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; }
}
7 changes: 7 additions & 0 deletions src/Custom/Containers/CreateContainerBodyExpiresAfter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace OpenAI.Containers;

public partial class CreateContainerBodyExpiresAfter
{
// CUSTOM: Make public property for back compatibility.
public string Anchor { get; } = "last_active_at";
}
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
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@ public partial class ChatCompletionMessageListDatum
[Experimental("SCME0001")]
private JsonPatch _patch;

internal ChatCompletionMessageListDatum(string content, string refusal, ChatMessageRole role, string id)
internal ChatCompletionMessageListDatum(string content, string refusal, string id)
{
Content = content;
Refusal = refusal;
ToolCalls = new ChangeTrackingList<ChatToolCall>();
Annotations = new ChangeTrackingList<ChatMessageAnnotation>();
Role = role;
Id = id;
}

Expand Down
8 changes: 0 additions & 8 deletions src/Generated/Models/Chat/ChatTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,6 @@ public partial class ChatTool
[Experimental("SCME0001")]
private JsonPatch _patch;

internal ChatTool(ChatToolKind kind, InternalFunctionDefinition function)
{
Argument.AssertNotNull(function, nameof(function));

Kind = kind;
Function = function;
}

#pragma warning disable SCME0001 // Type is for evaluation purposes only and is subject to change or removal in future updates.
internal ChatTool(ChatToolKind kind, InternalFunctionDefinition function, in JsonPatch patch)
{
Expand Down
11 changes: 0 additions & 11 deletions src/Generated/Models/Chat/ChatToolCall.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using System.ClientModel.Primitives;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using OpenAI;

namespace OpenAI.Chat
{
Expand All @@ -14,16 +13,6 @@ public partial class ChatToolCall
[Experimental("SCME0001")]
private JsonPatch _patch;

internal ChatToolCall(string id, ChatToolCallKind kind, InternalChatCompletionMessageToolCallFunction function)
{
Argument.AssertNotNull(id, nameof(id));
Argument.AssertNotNull(function, nameof(function));

Id = id;
Kind = kind;
Function = function;
}

#pragma warning disable SCME0001 // Type is for evaluation purposes only and is subject to change or removal in future updates.
internal ChatToolCall(string id, ChatToolCallKind kind, InternalChatCompletionMessageToolCallFunction function, in JsonPatch patch)
{
Expand Down
Loading
Loading