Skip to content

Commit

Permalink
chore: rename VectorizerField to Vectorizer
Browse files Browse the repository at this point in the history
  • Loading branch information
Askir committed Dec 4, 2024
1 parent 60a3327 commit 36cf4d9
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion projects/pgai/pgai/sqlalchemy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class EmbeddingModel(DeclarativeBase, Generic[T]):
parent: T # Type of the parent model


class VectorizerField:
class Vectorizer:
def __init__(
self,
dimensions: int,
Expand Down
4 changes: 2 additions & 2 deletions projects/pgai/tests/vectorizer/extensions/test_sqlalchemy.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from testcontainers.postgres import PostgresContainer # type: ignore

from pgai.cli import vectorizer_worker
from pgai.sqlalchemy import VectorizerField
from pgai.sqlalchemy import Vectorizer


def test_sqlalchemy(postgres_container: PostgresContainer, initialized_engine: Engine):
Expand All @@ -20,7 +20,7 @@ class BlogPost(Base):
title = Column(Text, nullable=False)
content = Column(Text, nullable=False)

content_embeddings = VectorizerField(
content_embeddings = Vectorizer(
dimensions=768,
add_relationship=True,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from testcontainers.postgres import PostgresContainer # type: ignore

from pgai.cli import vectorizer_worker
from pgai.sqlalchemy import EmbeddingModel, VectorizerField
from pgai.sqlalchemy import EmbeddingModel, Vectorizer


class Base(DeclarativeBase):
Expand All @@ -18,7 +18,7 @@ class Author(Base):
first_name = Column(Text, primary_key=True)
last_name = Column(Text, primary_key=True)
bio = Column(Text, nullable=False)
bio_embeddings = VectorizerField(
bio_embeddings = Vectorizer(
dimensions=768,
add_relationship=True,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from testcontainers.postgres import PostgresContainer # type: ignore

from pgai.cli import vectorizer_worker
from pgai.sqlalchemy import VectorizerField
from pgai.sqlalchemy import Vectorizer


class Base(DeclarativeBase):
Expand All @@ -18,7 +18,7 @@ class BlogPost(Base):
id = Column(Integer, primary_key=True)
title = Column(Text, nullable=False)
content = Column(Text, nullable=False)
content_embeddings = VectorizerField(dimensions=1536)
content_embeddings = Vectorizer(dimensions=1536)


def run_vectorizer_worker(db_url: str, vectorizer_id: int) -> None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from testcontainers.postgres import PostgresContainer # type: ignore

from pgai.cli import vectorizer_worker
from pgai.sqlalchemy import VectorizerField
from pgai.sqlalchemy import Vectorizer


class Base(DeclarativeBase):
Expand All @@ -18,7 +18,7 @@ class BlogPost(Base):
id = Column(Integer, primary_key=True)
title = Column(Text, nullable=False)
content = Column(Text, nullable=False)
content_embeddings = VectorizerField(
content_embeddings = Vectorizer(
dimensions=768,
add_relationship=False,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from testcontainers.postgres import PostgresContainer # type: ignore

from pgai.cli import vectorizer_worker
from pgai.sqlalchemy import EmbeddingModel, VectorizerField
from pgai.sqlalchemy import EmbeddingModel, Vectorizer


class Base(DeclarativeBase):
Expand All @@ -18,7 +18,7 @@ class BlogPost(Base):
id = Column(Integer, primary_key=True)
title = Column(Text, nullable=False)
content = Column(Text, nullable=False)
content_embeddings = VectorizerField(
content_embeddings = Vectorizer(
dimensions=768,
add_relationship=True,
)
Expand Down

0 comments on commit 36cf4d9

Please sign in to comment.