Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to EF 9.0 and use Vector Search capability #481

Open
abbottdev opened this issue Dec 17, 2024 · 0 comments
Open

Update to EF 9.0 and use Vector Search capability #481

abbottdev opened this issue Dec 17, 2024 · 0 comments
Labels
priority: p3 Desirable enhancement or fix. May not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@abbottdev
Copy link

Thanks for stopping by to let us know something could be better!

Is your feature request related to a problem? Please describe.
Cloud Spanner has introduced Vector Search capabilities; which EF 9.0 now has native support for with the IsVector extension methods.

See: https://learn.microsoft.com/en-us/ef/core/what-is-new/ef-core-9.0/whatsnew#vector-similarity-search-preview

Describe the solution you'd like
Be able to define a column as a Vector type using EF and the DDL created for Cloud Spanner marks up the ARRAY type as a Vector index.

    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        modelBuilder.Entity<Blog>()
            .Property(b => b.Embeddings)
            .IsVector(DistanceFunction.Cosine, dimensions: 1536);
    }

When using the Where predicate, if the operator is a Vector Search, the translated SQL statements generated are vector searches:

var blogs = await context.Blogs
    .OrderBy(s => EF.Functions.VectorDistance(s.Vector, vector))
    .Take(5)
    .ToListAsync();
@abbottdev abbottdev added priority: p3 Desirable enhancement or fix. May not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. labels Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p3 Desirable enhancement or fix. May not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

1 participant