Skip to content
Merged
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
9 changes: 7 additions & 2 deletions src/Custom/Embeddings/EmbeddingClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -170,15 +170,20 @@ public virtual ClientResult<OpenAIEmbedding> GenerateEmbedding(string input, Emb
/// <param name="cancellationToken"> A token that can be used to cancel this method call. </param>
/// <exception cref="ArgumentNullException"> <paramref name="inputs"/> is null. </exception>
/// <exception cref="ArgumentException"> <paramref name="inputs"/> is an empty collection, and was expected to be non-empty. </exception>
public virtual async Task<ClientResult<OpenAIEmbeddingCollection>> GenerateEmbeddingsAsync(IEnumerable<string> inputs, EmbeddingGenerationOptions options = null, CancellationToken cancellationToken = default)
public virtual Task<ClientResult<OpenAIEmbeddingCollection>> GenerateEmbeddingsAsync(IEnumerable<string> inputs, EmbeddingGenerationOptions options = null, CancellationToken cancellationToken = default)
{
return GenerateEmbeddingsAsync(inputs, options, cancellationToken.ToRequestOptions());
}

internal async Task<ClientResult<OpenAIEmbeddingCollection>> GenerateEmbeddingsAsync(IEnumerable<string> inputs, EmbeddingGenerationOptions options, RequestOptions requestOptions)
{
Argument.AssertNotNullOrEmpty(inputs, nameof(inputs));

options ??= new();
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());

}
Expand Down