.Net: [MEVD] Allow mapping the same .NET property to both data and vector properties in the database #11734
Labels
msft.ext.vectordata
Related to Microsoft.Extensions.VectorData
.NET
Issue or Pull requests regarding .NET code
In #10492, we're adding the ability to map arbitrary properties to a data store vector property, via an IEmbeddingGenerator:
The slight issue here is that currently maps Description only to a vector property; we believe there are non-contrived scenarios out there where users want to fetch back the description (as a string) when searching/getting records. We also believe some users would reasonably expect the above to just roundtrip, and would be a bit surprised when it doesn't.
Option 1 (Current): two .NET properties, one pointing to the other
The current way for users to do this is to have two properties as follows:
Note that this also allows easily e.g. concatenating multiple string properties together for embedding generation, or any arbitrary transformation.
Option 2: single .NET property, implicitly mapped to both vector and data
One possible design would be to implicitly map the above single .NET property to two database properties for the user. That is, the single Description .NET property would be mapped to a Description data property, and also to e.g. a
Description_Embedding
property (via some arbitrary naming convention). We don't like this design because:If we did want to do this, we'd need to do it now, since doing it later would be a breaking change.
Option 3: single .NET property, multiple attributes
An alternative would be for the user to simply annotated the same .NET property with two attributes:
Importantly, this is something that we should be able to implement later without any breaking changes. We currently throw in model validation when the same .NET property has more than one attribute - we'd just relax that.
/cc @adamsitnik @eavanvalkenburg hopefully this captures our conversation!
/cc @westey-m @dmytrostruk
The text was updated successfully, but these errors were encountered: