Skip to content

Commit a188868

Browse files
authored
Update embeddings_function -> embeddings (#21)
API update for vectorstore
1 parent 685e03a commit a188868

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

langchain_postgres/vectorstores.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ class PGVector(VectorStore):
237237

238238
def __init__(
239239
self,
240-
embedding_function: Embeddings,
240+
embeddings: Embeddings,
241241
*,
242242
connection: Optional[Connection] = None,
243243
embedding_length: Optional[int] = None,
@@ -255,7 +255,7 @@ def __init__(
255255
256256
Args:
257257
connection: Postgres connection string.
258-
embedding_function: Any embedding function implementing
258+
embeddings: Any embedding function implementing
259259
`langchain.embeddings.base.Embeddings` interface.
260260
embedding_length: The length of the embedding vector. (default: None)
261261
NOTE: This is not mandatory. Defining it will prevent vectors of
@@ -278,7 +278,7 @@ def __init__(
278278
doesn't exist. disabling creation is useful when using ReadOnly
279279
Databases.
280280
"""
281-
self.embedding_function = embedding_function
281+
self.embedding_function = embeddings
282282
self._embedding_length = embedding_length
283283
self.collection_name = collection_name
284284
self.collection_metadata = collection_metadata
@@ -441,7 +441,7 @@ def __from(
441441
store = cls(
442442
connection=connection,
443443
collection_name=collection_name,
444-
embedding_function=embedding,
444+
embeddings=embedding,
445445
distance_strategy=distance_strategy,
446446
pre_delete_collection=pre_delete_collection,
447447
use_jsonb=use_jsonb,
@@ -1068,7 +1068,7 @@ def from_existing_index(
10681068
store = cls(
10691069
connection=connection,
10701070
collection_name=collection_name,
1071-
embedding_function=embedding,
1071+
embeddings=embedding,
10721072
distance_strategy=distance_strategy,
10731073
pre_delete_collection=pre_delete_collection,
10741074
)

tests/unit_tests/test_vectorstore.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ def test_pgvector_collection_with_metadata() -> None:
155155
pgvector = PGVector(
156156
collection_name="test_collection",
157157
collection_metadata={"foo": "bar"},
158-
embedding_function=FakeEmbeddingsWithAdaDimension(),
158+
embeddings=FakeEmbeddingsWithAdaDimension(),
159159
connection=CONNECTION_STRING,
160160
pre_delete_collection=True,
161161
)

0 commit comments

Comments
 (0)