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

.Net: [MEVD] Review our attribute design #11318

Open
roji opened this issue Apr 1, 2025 · 2 comments
Open

.Net: [MEVD] Review our attribute design #11318

roji opened this issue Apr 1, 2025 · 2 comments
Assignees
Labels
Build Features planned for next Build conference msft.ext.vectordata Related to Microsoft.Extensions.VectorData .NET Issue or Pull requests regarding .NET code

Comments

@roji
Copy link
Member

roji commented Apr 1, 2025

VectorStoreRecordDataAttribute and VectorStoreRecordKeyAttribute have no constructors, and only have properties (note that some have set;, others init;.

In contrast, VectorStoreRecordVectorAttribute has 4 constructors, with all but StoragePropertyName being private. The Dimensions property is a nullable int, but the parameter in the various constructors is non-nullable (though a parameterless constructor exists, allowing dimensions to not be set).

If we want to force the user to set the dimensions, we probably need to remove the parameterless constructor; otherwise, if it really should be optional, we could just make the property settable (or initable). The other properties - DistanceFunction and IndexKind which are already optional - can also simply be directly settable.

Note: a version of this was raised before by @dluc in #11265.
Note: when we decide here, make sure to take that into account in the new model (see #11264 (comment)).

@roji roji added .NET Issue or Pull requests regarding .NET code Build Features planned for next Build conference msft.ext.vectordata Related to Microsoft.Extensions.VectorData labels Apr 1, 2025
@github-actions github-actions bot changed the title [MEVD] Review our attribute design .Net: [MEVD] Review our attribute design Apr 1, 2025
@dluc
Copy link
Contributor

dluc commented Apr 2, 2025

Note: there are scenarios where Dimension shouldn't be mandatory:

  • checking if a collection exists
  • deleting a collection
  • searching a non-existing collection (should return 404 rather than a bad request or other errors)

Also, there's a different approach where the code automatically detects the vector size, by the vector given during the first insert, when a collection is automatically created. This is the approach I've preferred in my apps, to reduce the need of changing conf, rebuilding code, etc.

@roji
Copy link
Member Author

roji commented Apr 2, 2025

checking if a collection exists
deleting a collection

These are operations where an IVectorStoreRecordCollection (and/or record definition) shouldn't needed in the first place, i.e. they should be doable from IVectorStore, and so seem unrelated to this issue. The 2nd is already tracked by #10881 - I've added existence checking to that issue as well (as the two are pretty related).

This issue is about when you do need an IVectorStoreRecordCollection with a definition (e.g. because you want to search or do CRUD operations) - is a dimension required for that case.

searching a non-existing collection (should return 404 rather than a bad request or other errors)

This one I don't understand - how does the fact that a collection exist or doesn't exist relate to whether Dimension should be required or not? When MEVD sends a search to the database, it's oblivious to whether the collection exists or not (it could have existed a second ago but have been deleted in the meantime), can you explain a bit more on how you see this as relevant here?

(re the error/exception that gets thrown when trying to access a non-existing collection, you already reported that in #11282)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Build Features planned for next Build conference msft.ext.vectordata Related to Microsoft.Extensions.VectorData .NET Issue or Pull requests regarding .NET code
Projects
None yet
Development

No branches or pull requests

4 participants