Hi, using a simple model like
from sqlalchemy import SQLModel
from pgvector.sqlalchemy import HalfVector
class Item(SQLModel, table=True):
embedding: Any = Field(sa_type=HalfVector((3072,)))
Results in a sqlalchemy.exc.ArgumentError: 'SchemaItem' object, such as a 'Column' or a 'Constraint' expected, got HalfVector([3072.0]) when attempting to load it. Using Vector instead works fine.
The difference seems to be that Vector is an alias for VECTOR, which derives from sqlalchemy.types.UserDefinedTypes, whereas HalfVector is distinct from HALFVEC. Using HALFVEC instead appears to work.
It appears to be the same situation for SparseVector.