This example assumes using Chroma; is in scope and apiKey contains your Chroma API key.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 | var request = new AddCollectionRecordsPayload
{
Embeddings = new EmbeddingsPayload(
embeddingsPayloadVariant1: [[1.0f, 2.0f]],
embeddingsPayloadVariant2: null),
Ids = ["record-1"],
Metadatas =
[
new HashMap
{
AdditionalProperties = new Dictionary<string, object>
{
["book"] = "Fahrenheit 451",
["page"] = 112L,
},
},
],
};
string json = request.ToJson();
using JsonDocument document = JsonDocument.Parse(json);
JsonElement metadata = document.RootElement.GetProperty("metadatas")[0];
|