Skip to content

.Net: [MEVD] Allow a raw embedding property to reference a source data property to get generated from #11736

Closed

Description

@roji

In #10492, we're adding the ability to map arbitrary properties to a data store vector property, via an IEmbeddingGenerator:

[VectorStoreRecordVector(Dimensions: 3)]
public string Description { get; set; }

This hides the raw embedding, which was a primary goal of the design (the user shouldn't need to deal with or be aware of ReadOnlyMemory<float>). However, it notably means that users cannot fetch back the embedding from the database. We generally agree that this is a niche scenario (it's quite rare for the embedding to actually be useful - possibly for further custom filtering in .NET), and vector databases indeed don't by default return vectors when searching, but we still those niche scenarios to be supported.

Today, users can do this by handling embedding generation themselves:

[VectorStoreRecordVector(Dimensions: 3)]
public ReadOnlyMemory<float> DescriptionEmbedding { get; set; }

This means that they need to use IEmbeddingGenerator themselves outside of MEVD, and call SearchEmbeddingAsync instead of SearchAsync to pass in the raw embedding.

We could make this better by allowing a raw embedding property to reference a source data property:

[VectorStoreRecordData]
public string Description { get; set; }

[VectorStoreRecordVector(Dimensions: 3, SourceProperty: nameof(Description)]
public ReadOnlyMemory<float> DescriptionEmbedding { get; set; }

When the proposed SourceProperty parameter is set, DescriptionEmbedding is treated like an embedding-generated property, just like today: any default IEmbeddingGenerator is picked up and used when upserting new records. When returning records, both properties are populated from the database as usual, and the user can access the embeddings.

Note that SourceProperty refers to a .NET property, and not to a database property. This means that it can refer to a non-persisted property that e.g. concatenates multiple other .NET properties.

AFAICT there's nothing blocking us from adding this in the future (no breaking change).

Activity

  1. changed the title [-][MEVD] Allow a raw embedding property to reference a source data property to get generated from[/-] [+].Net: [MEVD] Allow a raw embedding property to reference a source data property to get generated from[/+] on Apr 25, 2025
  2. github-actions commented on Jul 25, 2025

    @github-actions
    Contributor

    This issue is stale because it has been open for 90 days with no activity.

  3. added
    staleIssue is stale because it has been open for a while and has no activity
    on Jul 25, 2025
  4. github-actions commented on May 20, 2026

    @github-actions
    Contributor

    This issue was closed because it has been inactive for 14 days since being marked as stale.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    .NETIssue or Pull requests regarding .NET codemsft.ext.vectordataRelated to Microsoft.Extensions.VectorDatastaleIssue is stale because it has been open for a while and has no activity

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions