put try/except block
This commit is contained in:
parent
f567a33883
commit
3e6e6b44b5
1 changed files with 12 additions and 9 deletions
|
|
@ -14,7 +14,9 @@ class PostgresqlVectorComponent(CustomComponent):
|
||||||
|
|
||||||
display_name: str = "PGVector"
|
display_name: str = "PGVector"
|
||||||
description: str = "Implementation of Vector Store using PostgreSQL"
|
description: str = "Implementation of Vector Store using PostgreSQL"
|
||||||
documentation = "https://python.langchain.com/docs/integrations/vectorstores/pgvector"
|
documentation = (
|
||||||
|
"https://python.langchain.com/docs/integrations/vectorstores/pgvector"
|
||||||
|
)
|
||||||
beta = True
|
beta = True
|
||||||
|
|
||||||
def build_config(self):
|
def build_config(self):
|
||||||
|
|
@ -56,11 +58,12 @@ class PostgresqlVectorComponent(CustomComponent):
|
||||||
- VectorStore: The Vector Store object.
|
- VectorStore: The Vector Store object.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
return PGVector.from_documents(
|
try:
|
||||||
embedding=embedding,
|
return PGVector.from_documents(
|
||||||
documents=documents,
|
embedding=embedding,
|
||||||
collection_name=collection_name,
|
documents=documents,
|
||||||
connection_string=pg_server_url,
|
collection_name=collection_name,
|
||||||
)
|
connection_string=pg_server_url,
|
||||||
|
)
|
||||||
|
except Exception as e:
|
||||||
|
raise RuntimeError(f"Failed to build Vector Store: {str(e)}")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue