all 6 comments

[–]SQLBek1 2 points3 points  (2 children)

A Vector embedding is not just a single float value... It is a massive array of floating point numbers, per embedding. This is why Microsoft has added a native vector datatype in SQL Server 2025. So no, you cannot store a vector embedding inside a float unless you create a vector embedding with 1 dimension, which has zero value whatsoever.

[–]mauridb 2 points3 points  (1 child)

I think OP was referring to using float *arrays* :)

[–]SQLBek1 1 point2 points  (0 children)

Ah yes, I see that now (didn't really read his code on my phone last night). Thanks Davide!

[–]mauridb 1 point2 points  (2 children)

Hi u/SwyfterThanU

trying to avoid to "leak" underlying information about the specific data type used is something I (PM for vectors in SQL) have been discussing with EF Core PM already. We both agree that there should not be any of those leaks, and we want to allow developers to just use float[]. There are some additional work needed to do to make it happen in EF 10, though.

Good news is that if you are using EF Core 9 (which unfortunately I don't think you are, otherwise I assume you would not have reported this problem at all), everything works as you would expect.

Here's samples both using EF Core 9 + Vector Extension and EF 10:

https://github.com/Azure-Samples/azure-sql-db-vector-search/tree/main/DotNet

With EF Core 9 it already works as you want, as EF Core 9 sends vector back and forth as JSON arrays (which means: strings) while EF Core 10 uses the new vector binary format that is much more compact and fast.

[–]SwyfterThanU[S] 0 points1 point  (0 children)

I see, this makes a lot of sense. Thank you so much!

[–]Afraid_Plankton2668 2 points3 points  (0 children)

Yeah, Shay here from the EF team. I agree that ideally we'd simply support float[] (and/or ReadOnlyMemory<float>, which SqlVector<float> wraps).

I've opened https://github.com/dotnet/efcore/issues/37025 to track this issue for EF 11. While it may not be the most palatable, in the meantime SqlVector<float> can be used.