Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions langchain_postgres/vectorstores.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ class PGVector(VectorStore):

def __init__(
self,
embedding_function: Embeddings,
embeddings: Embeddings,
*,
connection: Optional[Connection] = None,
embedding_length: Optional[int] = None,
Expand All @@ -255,7 +255,7 @@ def __init__(

Args:
connection: Postgres connection string.
embedding_function: Any embedding function implementing
embeddings: Any embedding function implementing
`langchain.embeddings.base.Embeddings` interface.
embedding_length: The length of the embedding vector. (default: None)
NOTE: This is not mandatory. Defining it will prevent vectors of
Expand All @@ -278,7 +278,7 @@ def __init__(
doesn't exist. disabling creation is useful when using ReadOnly
Databases.
"""
self.embedding_function = embedding_function
self.embedding_function = embeddings
self._embedding_length = embedding_length
self.collection_name = collection_name
self.collection_metadata = collection_metadata
Expand Down Expand Up @@ -441,7 +441,7 @@ def __from(
store = cls(
connection=connection,
collection_name=collection_name,
embedding_function=embedding,
embeddings=embedding,
distance_strategy=distance_strategy,
pre_delete_collection=pre_delete_collection,
use_jsonb=use_jsonb,
Expand Down Expand Up @@ -1068,7 +1068,7 @@ def from_existing_index(
store = cls(
connection=connection,
collection_name=collection_name,
embedding_function=embedding,
embeddings=embedding,
distance_strategy=distance_strategy,
pre_delete_collection=pre_delete_collection,
)
Expand Down
2 changes: 1 addition & 1 deletion tests/unit_tests/test_vectorstore.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def test_pgvector_collection_with_metadata() -> None:
pgvector = PGVector(
collection_name="test_collection",
collection_metadata={"foo": "bar"},
embedding_function=FakeEmbeddingsWithAdaDimension(),
embeddings=FakeEmbeddingsWithAdaDimension(),
connection=CONNECTION_STRING,
pre_delete_collection=True,
)
Expand Down