Skip to content
Open
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.20251001.2" />
<PackageReference Include="Microsoft.TypeSpec.Generator.ClientModel" Version="1.0.0-alpha.20251031.1" />
</ItemGroup>

<!-- Copy output to package dist path for local execution and -->
Expand Down
8 changes: 4 additions & 4 deletions codegen/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@
],
"dependencies": {
"@open-ai/plugin": "file:",
"@azure-tools/typespec-client-generator-core": "0.60.0",
"@typespec/http-client-csharp": "1.0.0-alpha.20251001.2",
"@typespec/http": "1.4.0",
"@typespec/openapi": "1.4.0"
"@azure-tools/typespec-client-generator-core": "0.61.0",
"@typespec/http-client-csharp": "1.0.0-alpha.20251031.1",
"@typespec/http": "1.5.0",
"@typespec/openapi": "1.5.0"
},
"devDependencies": {
"@types/node": "^22.8.1",
Expand Down
576 changes: 288 additions & 288 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/Generated/AssistantClient.RestClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ internal virtual PipelineMessage CreateGetAssistantsRequest(int? limit, string o
uri.AppendPath("/assistants", false);
if (limit != null)
{
uri.AppendQuery("limit", TypeFormatters.ConvertToString(limit, null), true);
uri.AppendQuery("limit", TypeFormatters.ConvertToString(limit), true);
}
if (order != null)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Generated/AssistantClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public virtual CollectionResult<Assistant> GetAssistants(AssistantCollectionOpti
options?.Order?.ToString(),
options?.AfterId,
options?.BeforeId,
cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null);
cancellationToken.ToRequestOptions());
}

public virtual AsyncCollectionResult<Assistant> GetAssistantsAsync(AssistantCollectionOptions options = default, CancellationToken cancellationToken = default)
Expand All @@ -64,7 +64,7 @@ public virtual AsyncCollectionResult<Assistant> GetAssistantsAsync(AssistantColl
options?.Order?.ToString(),
options?.AfterId,
options?.BeforeId,
cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null);
cancellationToken.ToRequestOptions());
}

public virtual ClientResult CreateAssistant(BinaryContent content, RequestOptions options = null)
Expand Down
2 changes: 1 addition & 1 deletion src/Generated/BatchClient.RestClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ internal virtual PipelineMessage CreateGetBatchesRequest(string after, int? limi
}
if (limit != null)
{
uri.AppendQuery("limit", TypeFormatters.ConvertToString(limit, null), true);
uri.AppendQuery("limit", TypeFormatters.ConvertToString(limit), true);
}
PipelineMessage message = Pipeline.CreateMessage(uri.ToUri(), "GET", PipelineMessageClassifier200);
PipelineRequest request = message.Request;
Expand Down
20 changes: 20 additions & 0 deletions src/Generated/BatchClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
using System;
using System.ClientModel;
using System.ClientModel.Primitives;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Threading;
using System.Threading.Tasks;
using OpenAI;

Expand All @@ -22,6 +24,24 @@ protected BatchClient()

public ClientPipeline Pipeline { get; }

public virtual ClientResult<InternalBatchJob> CreateBatch(string inputFileId, InternalCreateBatchRequestEndpoint endpoint, IDictionary<string, string> metadata = default, CancellationToken cancellationToken = default)
{
Argument.AssertNotNullOrEmpty(inputFileId, nameof(inputFileId));

InternalCreateBatchRequest spreadModel = new InternalCreateBatchRequest(default, endpoint, "24h", metadata, default);
ClientResult result = this.CreateBatch(spreadModel, cancellationToken.ToRequestOptions());
return ClientResult.FromValue((InternalBatchJob)result, result.GetRawResponse());
}

public virtual async Task<ClientResult<InternalBatchJob>> CreateBatchAsync(string inputFileId, InternalCreateBatchRequestEndpoint endpoint, IDictionary<string, string> metadata = default, CancellationToken cancellationToken = default)
{
Argument.AssertNotNullOrEmpty(inputFileId, nameof(inputFileId));

InternalCreateBatchRequest spreadModel = new InternalCreateBatchRequest(default, endpoint, "24h", metadata, default);
ClientResult result = await this.CreateBatchAsync(spreadModel, cancellationToken.ToRequestOptions()).ConfigureAwait(false);
return ClientResult.FromValue((InternalBatchJob)result, result.GetRawResponse());
}

public virtual ClientResult GetBatch(string batchId, RequestOptions options)
{
Argument.AssertNotNullOrEmpty(batchId, nameof(batchId));
Expand Down
6 changes: 3 additions & 3 deletions src/Generated/ChatClient.RestClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ internal virtual PipelineMessage CreateGetChatCompletionsRequest(string after, i
}
if (limit != null)
{
uri.AppendQuery("limit", TypeFormatters.ConvertToString(limit, null), true);
uri.AppendQuery("limit", TypeFormatters.ConvertToString(limit), true);
}
if (order != null)
{
Expand All @@ -40,7 +40,7 @@ internal virtual PipelineMessage CreateGetChatCompletionsRequest(string after, i
// Plugin customization: Properly handle metadata query parameters
uri.AppendQuery($"metadata[{@param.Key}]", @param.Value, true);
}
// Plugin customization: remove unnecessary AppendQueryDelimited for metadata
uri.AppendQueryDelimited("metadata", list, ",", escape: true);
}
if (model != null)
{
Expand Down Expand Up @@ -121,7 +121,7 @@ internal virtual PipelineMessage CreateGetChatCompletionMessagesRequest(string c
}
if (limit != null)
{
uri.AppendQuery("limit", TypeFormatters.ConvertToString(limit, null), true);
uri.AppendQuery("limit", TypeFormatters.ConvertToString(limit), true);
}
if (order != null)
{
Expand Down
8 changes: 4 additions & 4 deletions src/Generated/ChatClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public virtual CollectionResult<ChatCompletion> GetChatCompletions(ChatCompletio
options?.Order?.ToString(),
options?.Metadata,
options?.Model,
cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null);
cancellationToken.ToRequestOptions());
}

[Experimental("OPENAI001")]
Expand All @@ -72,7 +72,7 @@ public virtual AsyncCollectionResult<ChatCompletion> GetChatCompletionsAsync(Cha
options?.Order?.ToString(),
options?.Metadata,
options?.Model,
cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null);
cancellationToken.ToRequestOptions());
}

public virtual ClientResult CompleteChat(BinaryContent content, RequestOptions options = null)
Expand Down Expand Up @@ -186,7 +186,7 @@ public virtual CollectionResult<ChatCompletionMessageListDatum> GetChatCompletio
options?.AfterId,
options?.PageSizeLimit,
options?.Order?.ToString(),
cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null);
cancellationToken.ToRequestOptions());
}

[Experimental("OPENAI001")]
Expand All @@ -200,7 +200,7 @@ public virtual AsyncCollectionResult<ChatCompletionMessageListDatum> GetChatComp
options?.AfterId,
options?.PageSizeLimit,
options?.Order?.ToString(),
cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null);
cancellationToken.ToRequestOptions());
}
}
}
4 changes: 2 additions & 2 deletions src/Generated/ContainerClient.RestClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ internal virtual PipelineMessage CreateGetContainersRequest(int? limit, string o
uri.AppendPath("/containers", false);
if (limit != null)
{
uri.AppendQuery("limit", TypeFormatters.ConvertToString(limit, null), true);
uri.AppendQuery("limit", TypeFormatters.ConvertToString(limit), true);
}
if (order != null)
{
Expand Down Expand Up @@ -103,7 +103,7 @@ internal virtual PipelineMessage CreateGetContainerFilesRequest(string container
uri.AppendPath("/files", false);
if (limit != null)
{
uri.AppendQuery("limit", TypeFormatters.ConvertToString(limit, null), true);
uri.AppendQuery("limit", TypeFormatters.ConvertToString(limit), true);
}
if (order != null)
{
Expand Down
32 changes: 16 additions & 16 deletions src/Generated/ContainerClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ public virtual AsyncCollectionResult GetContainersAsync(int? limit, string order

public virtual CollectionResult<ContainerResource> GetContainers(ContainerCollectionOptions options = default, CancellationToken cancellationToken = default)
{
return new ContainerClientGetContainersCollectionResultOfT(this, options?.PageSizeLimit, options?.Order?.ToString(), options?.AfterId, cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null);
return new ContainerClientGetContainersCollectionResultOfT(this, options?.PageSizeLimit, options?.Order?.ToString(), options?.AfterId, cancellationToken.ToRequestOptions());
}

public virtual AsyncCollectionResult<ContainerResource> GetContainersAsync(ContainerCollectionOptions options = default, CancellationToken cancellationToken = default)
{
return new ContainerClientGetContainersAsyncCollectionResultOfT(this, options?.PageSizeLimit, options?.Order?.ToString(), options?.AfterId, cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null);
return new ContainerClientGetContainersAsyncCollectionResultOfT(this, options?.PageSizeLimit, options?.Order?.ToString(), options?.AfterId, cancellationToken.ToRequestOptions());
}

public virtual ClientResult CreateContainer(BinaryContent content, RequestOptions options = null)
Expand All @@ -63,15 +63,15 @@ public virtual ClientResult<ContainerResource> CreateContainer(CreateContainerBo
{
Argument.AssertNotNull(body, nameof(body));

ClientResult result = CreateContainer(body, cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null);
ClientResult result = CreateContainer(body, cancellationToken.ToRequestOptions());
return ClientResult.FromValue((ContainerResource)result, result.GetRawResponse());
}

public virtual async Task<ClientResult<ContainerResource>> CreateContainerAsync(CreateContainerBody body, CancellationToken cancellationToken = default)
{
Argument.AssertNotNull(body, nameof(body));

ClientResult result = await CreateContainerAsync(body, cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null).ConfigureAwait(false);
ClientResult result = await CreateContainerAsync(body, cancellationToken.ToRequestOptions()).ConfigureAwait(false);
return ClientResult.FromValue((ContainerResource)result, result.GetRawResponse());
}

Expand All @@ -95,15 +95,15 @@ public virtual ClientResult<ContainerResource> GetContainer(string containerId,
{
Argument.AssertNotNullOrEmpty(containerId, nameof(containerId));

ClientResult result = GetContainer(containerId, cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null);
ClientResult result = GetContainer(containerId, cancellationToken.ToRequestOptions());
return ClientResult.FromValue((ContainerResource)result, result.GetRawResponse());
}

public virtual async Task<ClientResult<ContainerResource>> GetContainerAsync(string containerId, CancellationToken cancellationToken = default)
{
Argument.AssertNotNullOrEmpty(containerId, nameof(containerId));

ClientResult result = await GetContainerAsync(containerId, cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null).ConfigureAwait(false);
ClientResult result = await GetContainerAsync(containerId, cancellationToken.ToRequestOptions()).ConfigureAwait(false);
return ClientResult.FromValue((ContainerResource)result, result.GetRawResponse());
}

Expand All @@ -127,15 +127,15 @@ public virtual ClientResult<DeleteContainerResponse> DeleteContainer(string cont
{
Argument.AssertNotNullOrEmpty(containerId, nameof(containerId));

ClientResult result = DeleteContainer(containerId, cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null);
ClientResult result = DeleteContainer(containerId, cancellationToken.ToRequestOptions());
return ClientResult.FromValue((DeleteContainerResponse)result, result.GetRawResponse());
}

public virtual async Task<ClientResult<DeleteContainerResponse>> DeleteContainerAsync(string containerId, CancellationToken cancellationToken = default)
{
Argument.AssertNotNullOrEmpty(containerId, nameof(containerId));

ClientResult result = await DeleteContainerAsync(containerId, cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null).ConfigureAwait(false);
ClientResult result = await DeleteContainerAsync(containerId, cancellationToken.ToRequestOptions()).ConfigureAwait(false);
return ClientResult.FromValue((DeleteContainerResponse)result, result.GetRawResponse());
}

Expand Down Expand Up @@ -193,7 +193,7 @@ public virtual CollectionResult<ContainerFileResource> GetContainerFiles(string
options?.PageSizeLimit,
options?.Order?.ToString(),
options?.AfterId,
cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null);
cancellationToken.ToRequestOptions());
}

public virtual AsyncCollectionResult<ContainerFileResource> GetContainerFilesAsync(string containerId, ContainerFileCollectionOptions options = default, CancellationToken cancellationToken = default)
Expand All @@ -206,7 +206,7 @@ public virtual AsyncCollectionResult<ContainerFileResource> GetContainerFilesAsy
options?.PageSizeLimit,
options?.Order?.ToString(),
options?.AfterId,
cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null);
cancellationToken.ToRequestOptions());
}

public virtual ClientResult GetContainerFile(string containerId, string fileId, RequestOptions options)
Expand All @@ -232,7 +232,7 @@ public virtual ClientResult<ContainerFileResource> GetContainerFile(string conta
Argument.AssertNotNullOrEmpty(containerId, nameof(containerId));
Argument.AssertNotNullOrEmpty(fileId, nameof(fileId));

ClientResult result = GetContainerFile(containerId, fileId, cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null);
ClientResult result = GetContainerFile(containerId, fileId, cancellationToken.ToRequestOptions());
return ClientResult.FromValue((ContainerFileResource)result, result.GetRawResponse());
}

Expand All @@ -241,7 +241,7 @@ public virtual async Task<ClientResult<ContainerFileResource>> GetContainerFileA
Argument.AssertNotNullOrEmpty(containerId, nameof(containerId));
Argument.AssertNotNullOrEmpty(fileId, nameof(fileId));

ClientResult result = await GetContainerFileAsync(containerId, fileId, cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null).ConfigureAwait(false);
ClientResult result = await GetContainerFileAsync(containerId, fileId, cancellationToken.ToRequestOptions()).ConfigureAwait(false);
return ClientResult.FromValue((ContainerFileResource)result, result.GetRawResponse());
}

Expand All @@ -268,7 +268,7 @@ public virtual ClientResult<DeleteContainerFileResponse> DeleteContainerFile(str
Argument.AssertNotNullOrEmpty(containerId, nameof(containerId));
Argument.AssertNotNullOrEmpty(fileId, nameof(fileId));

ClientResult result = DeleteContainerFile(containerId, fileId, cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null);
ClientResult result = DeleteContainerFile(containerId, fileId, cancellationToken.ToRequestOptions());
return ClientResult.FromValue((DeleteContainerFileResponse)result, result.GetRawResponse());
}

Expand All @@ -277,7 +277,7 @@ public virtual async Task<ClientResult<DeleteContainerFileResponse>> DeleteConta
Argument.AssertNotNullOrEmpty(containerId, nameof(containerId));
Argument.AssertNotNullOrEmpty(fileId, nameof(fileId));

ClientResult result = await DeleteContainerFileAsync(containerId, fileId, cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null).ConfigureAwait(false);
ClientResult result = await DeleteContainerFileAsync(containerId, fileId, cancellationToken.ToRequestOptions()).ConfigureAwait(false);
return ClientResult.FromValue((DeleteContainerFileResponse)result, result.GetRawResponse());
}

Expand All @@ -304,7 +304,7 @@ public virtual ClientResult<BinaryData> GetContainerFileContent(string container
Argument.AssertNotNullOrEmpty(containerId, nameof(containerId));
Argument.AssertNotNullOrEmpty(fileId, nameof(fileId));

ClientResult result = GetContainerFileContent(containerId, fileId, cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null);
ClientResult result = GetContainerFileContent(containerId, fileId, cancellationToken.ToRequestOptions());
return ClientResult.FromValue(result.GetRawResponse().Content, result.GetRawResponse());
}

Expand All @@ -313,7 +313,7 @@ public virtual async Task<ClientResult<BinaryData>> GetContainerFileContentAsync
Argument.AssertNotNullOrEmpty(containerId, nameof(containerId));
Argument.AssertNotNullOrEmpty(fileId, nameof(fileId));

ClientResult result = await GetContainerFileContentAsync(containerId, fileId, cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null).ConfigureAwait(false);
ClientResult result = await GetContainerFileContentAsync(containerId, fileId, cancellationToken.ToRequestOptions()).ConfigureAwait(false);
return ClientResult.FromValue(result.GetRawResponse().Content, result.GetRawResponse());
}
}
Expand Down
Loading