Add support for None documents in

PostgresqlVectorComponent
This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-11-10 10:46:57 -03:00
commit 4208e3f961

View file

@ -1,4 +1,4 @@
from typing import Optional
from typing import Optional, List
from langflow import CustomComponent
from langchain.vectorstores.pgvector import PGVector
@ -59,6 +59,13 @@ class PostgresqlVectorComponent(CustomComponent):
"""
try:
if documents is None:
return PGVector.from_existing_index(
embedding=embedding,
collection_name=collection_name,
connection_string=pg_server_url,
)
return PGVector.from_documents(
embedding=embedding,
documents=documents,