diff --git a/README.md b/README.md index 7c302b1..1551f38 100644 --- a/README.md +++ b/README.md @@ -183,7 +183,7 @@ class Item(Base): embedding = mapped_column(Vector(3)) ``` -Also supports `HALFVEC`, `BIT`, and `SPARSEVEC` +Also supports `HalfVector`, `Bit`, and `SparseVector` Insert a vector @@ -252,12 +252,12 @@ Use `vector_ip_ops` for inner product and `vector_cosine_ops` for cosine distanc Index vectors at half-precision ```python -from pgvector.sqlalchemy import HALFVEC +from pgvector.sqlalchemy import HalfVector from sqlalchemy.sql import func index = Index( 'my_index', - func.cast(Item.embedding, HALFVEC(3)).label('embedding'), + func.cast(Item.embedding, HalfVector(3)).label('embedding'), postgresql_using='hnsw', postgresql_with={'m': 16, 'ef_construction': 64}, postgresql_ops={'embedding': 'halfvec_l2_ops'} @@ -267,7 +267,7 @@ index = Index( Get the nearest neighbors ```python -order = func.cast(Item.embedding, HALFVEC(3)).l2_distance([3, 1, 2]) +order = func.cast(Item.embedding, HalfVector(3)).l2_distance([3, 1, 2]) session.scalars(select(Item).order_by(order).limit(5)) ``` @@ -335,7 +335,7 @@ class Item(SQLModel, table=True): embedding: Any = Field(sa_type=Vector(3)) ``` -Also supports `HALFVEC`, `BIT`, and `SPARSEVEC` +Also supports `HalfVector`, `Bit`, and `SparseVector` Insert a vector diff --git a/pgvector/sqlalchemy/__init__.py b/pgvector/sqlalchemy/__init__.py index 52adf88..7b145ee 100644 --- a/pgvector/sqlalchemy/__init__.py +++ b/pgvector/sqlalchemy/__init__.py @@ -1,21 +1,23 @@ from .bit import BIT +from .bit import BIT as Bit from .functions import avg, sum from .halfvec import HALFVEC +from .halfvec import HALFVEC as HalfVector from .sparsevec import SPARSEVEC +from .sparsevec import SPARSEVEC as SparseVector from .vector import VECTOR from .vector import VECTOR as Vector -# TODO remove -from .. import HalfVector, SparseVector __all__ = [ 'Vector', 'VECTOR', - 'HALFVEC', + 'Bit', 'BIT', - 'SPARSEVEC', 'HalfVector', + 'HALFVEC', 'SparseVector', + 'SPARSEVEC', 'avg', 'sum' ]