Skip to content

Commit

Permalink
Updated EmbeddingResult.Data to be a List rather than an array
Browse files Browse the repository at this point in the history
  • Loading branch information
OkGoDoIt committed Feb 3, 2023
1 parent 13fe061 commit 0788505
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion OpenAI_API/Embedding/EmbeddingResult.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Newtonsoft.Json;
using System.Collections.Generic;
using System.Linq;

namespace OpenAI_API.Embedding
Expand All @@ -12,7 +13,7 @@ public class EmbeddingResult : ApiResultBase
/// List of results of the embedding
/// </summary>
[JsonProperty("data")]
public Data[] Data { get; set; }
public List<Data> Data { get; set; }

/// <summary>
/// Usage statistics of how many tokens have been used for this request
Expand Down
2 changes: 1 addition & 1 deletion OpenAI_Tests/EmbeddingEndpointTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public void GetBasicEmbedding()
var results = api.Embeddings.CreateEmbeddingAsync(new EmbeddingRequest(Model.AdaTextEmbedding, "A test text for embedding")).Result;
Assert.IsNotNull(results);
Assert.NotNull(results.Object);
Assert.NotZero(results.Data.Length);
Assert.NotZero(results.Data.Count);
Assert.That(results.Data.First().Embedding.Length == 1536);
}

Expand Down

0 comments on commit 0788505

Please sign in to comment.