Array into metadata of vector #79
-
Hi, in the example the code is like this:
Now suppose I have a list of identifiers
How can i add this to the metadata?, I've try this:
but it doesn't work. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @MUSS-Davs , The way to deal with this is to map sequences / maps of your values to corresponding var idList = new List<string> { "id1", "id2", "id3" };
var metadata = new MetadataMap
{
["genre"] = "horror",
["duration"] = 120,
["idList"] = idList
.Select(id => (MetadataValue)id)
.ToArray()
};
var vector = new Vector
{
Id = "vector1",
Values = [0.1f, 0.2f, 0.3f],
Metadata = metadata
}; |
Beta Was this translation helpful? Give feedback.
Hi @MUSS-Davs ,
This is a restriction due to how metadata operates in relation to C# being strongly typed. Because
MetadataMap
is a dictionary ofstring:MetadataValue
s,List<string>
has to be converted toList<MetadataValue>
which itself can be implicitly converted toMetadataValue
node.The way to deal with this is to map sequences / maps of your values to corresponding
MetadataValue
s like this: