@@ -109,6 +109,7 @@ class PGVectorStore(BasePydanticVectorStore):
109109 hybrid_search : bool
110110 text_search_config : str
111111 cache_ok : bool
112+ perform_setup : bool
112113 debug : bool
113114
114115 _base : Any = PrivateAttr ()
@@ -129,6 +130,7 @@ def __init__(
129130 text_search_config : str = "english" ,
130131 embed_dim : int = 1536 ,
131132 cache_ok : bool = False ,
133+ perform_setup : bool = True ,
132134 debug : bool = False ,
133135 ) -> None :
134136 try :
@@ -175,6 +177,7 @@ def __init__(
175177 text_search_config = text_search_config ,
176178 embed_dim = embed_dim ,
177179 cache_ok = cache_ok ,
180+ perform_setup = perform_setup ,
178181 debug = debug ,
179182 )
180183
@@ -207,6 +210,7 @@ def from_params(
207210 text_search_config : str = "english" ,
208211 embed_dim : int = 1536 ,
209212 cache_ok : bool = False ,
213+ perform_setup : bool = True ,
210214 debug : bool = False ,
211215 ) -> "PGVectorStore" :
212216 """Return connection string from database parameters."""
@@ -226,6 +230,7 @@ def from_params(
226230 text_search_config = text_search_config ,
227231 embed_dim = embed_dim ,
228232 cache_ok = cache_ok ,
233+ perform_setup = perform_setup ,
229234 debug = debug ,
230235 )
231236
@@ -269,9 +274,10 @@ def _create_extension(self) -> None:
269274 def _initialize (self ) -> None :
270275 if not self ._is_initialized :
271276 self ._connect ()
272- self ._create_extension ()
273- self ._create_schema_if_not_exists ()
274- self ._create_tables_if_not_exists ()
277+ if self .perform_setup :
278+ self ._create_extension ()
279+ self ._create_schema_if_not_exists ()
280+ self ._create_tables_if_not_exists ()
275281 self ._is_initialized = True
276282
277283 def _node_to_table_row (self , node : BaseNode ) -> Any :
0 commit comments