Skip to content

Commit 0788505

Browse files
committed
Updated EmbeddingResult.Data to be a List rather than an array
1 parent 13fe061 commit 0788505

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

OpenAI_API/Embedding/EmbeddingResult.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using Newtonsoft.Json;
2+
using System.Collections.Generic;
23
using System.Linq;
34

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

1718
/// <summary>
1819
/// Usage statistics of how many tokens have been used for this request

OpenAI_Tests/EmbeddingEndpointTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public void GetBasicEmbedding()
2424
var results = api.Embeddings.CreateEmbeddingAsync(new EmbeddingRequest(Model.AdaTextEmbedding, "A test text for embedding")).Result;
2525
Assert.IsNotNull(results);
2626
Assert.NotNull(results.Object);
27-
Assert.NotZero(results.Data.Length);
27+
Assert.NotZero(results.Data.Count);
2828
Assert.That(results.Data.First().Embedding.Length == 1536);
2929
}
3030

0 commit comments

Comments
 (0)