diff --git a/src/Custom/Embeddings/EmbeddingClient.cs b/src/Custom/Embeddings/EmbeddingClient.cs index 79529b454..fce3a46c1 100644 --- a/src/Custom/Embeddings/EmbeddingClient.cs +++ b/src/Custom/Embeddings/EmbeddingClient.cs @@ -170,7 +170,12 @@ public virtual ClientResult GenerateEmbedding(string input, Emb /// A token that can be used to cancel this method call. /// is null. /// is an empty collection, and was expected to be non-empty. - public virtual async Task> GenerateEmbeddingsAsync(IEnumerable inputs, EmbeddingGenerationOptions options = null, CancellationToken cancellationToken = default) + public virtual Task> GenerateEmbeddingsAsync(IEnumerable inputs, EmbeddingGenerationOptions options = null, CancellationToken cancellationToken = default) + { + return GenerateEmbeddingsAsync(inputs, options, cancellationToken.ToRequestOptions()); + } + + internal async Task> GenerateEmbeddingsAsync(IEnumerable inputs, EmbeddingGenerationOptions options, RequestOptions requestOptions) { Argument.AssertNotNullOrEmpty(inputs, nameof(inputs)); @@ -178,7 +183,7 @@ public virtual async Task> GenerateEmbed CreateEmbeddingGenerationOptions(inputs, ref options); using BinaryContent content = options.ToBinaryContent(); - ClientResult result = await GenerateEmbeddingsAsync(content, cancellationToken.ToRequestOptions()).ConfigureAwait(false); + ClientResult result = await GenerateEmbeddingsAsync(content, requestOptions).ConfigureAwait(false); return ClientResult.FromValue((OpenAIEmbeddingCollection)result, result.GetRawResponse()); }