llama-index-vector-stores-postgres 0.2.2__tar.gz → 0.2.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: llama-index-vector-stores-postgres
3
- Version: 0.2.2
3
+ Version: 0.2.3
4
4
  Summary: llama-index vector_stores postgres integration
5
5
  License: MIT
6
6
  Author: Your Name
@@ -173,6 +173,7 @@ class PGVectorStore(BasePydanticVectorStore):
173
173
  debug: bool = False,
174
174
  use_jsonb: bool = False,
175
175
  hnsw_kwargs: Optional[Dict[str, Any]] = None,
176
+ create_engine_kwargs: Optional[Dict[str, Any]] = None,
176
177
  ) -> None:
177
178
  """Constructor.
178
179
 
@@ -191,6 +192,7 @@ class PGVectorStore(BasePydanticVectorStore):
191
192
  hnsw_kwargs (Optional[Dict[str, Any]], optional): HNSW kwargs, a dict that
192
193
  contains "hnsw_ef_construction", "hnsw_ef_search", "hnsw_m", and optionally "hnsw_dist_method". Defaults to None,
193
194
  which turns off HNSW search.
195
+ create_engine_kwargs (Optional[Dict[str, Any]], optional): Engine parameters to pass to create_engine. Defaults to None.
194
196
  """
195
197
  table_name = table_name.lower()
196
198
  schema_name = schema_name.lower()
@@ -231,6 +233,8 @@ class PGVectorStore(BasePydanticVectorStore):
231
233
  use_jsonb=use_jsonb,
232
234
  )
233
235
 
236
+ self.create_engine_kwargs = create_engine_kwargs or {}
237
+
234
238
  async def close(self) -> None:
235
239
  if not self._is_initialized:
236
240
  return
@@ -264,6 +268,7 @@ class PGVectorStore(BasePydanticVectorStore):
264
268
  debug: bool = False,
265
269
  use_jsonb: bool = False,
266
270
  hnsw_kwargs: Optional[Dict[str, Any]] = None,
271
+ create_engine_kwargs: Optional[Dict[str, Any]] = None,
267
272
  ) -> "PGVectorStore":
268
273
  """Construct from params.
269
274
 
@@ -287,6 +292,7 @@ class PGVectorStore(BasePydanticVectorStore):
287
292
  hnsw_kwargs (Optional[Dict[str, Any]], optional): HNSW kwargs, a dict that
288
293
  contains "hnsw_ef_construction", "hnsw_ef_search", "hnsw_m", and optionally "hnsw_dist_method". Defaults to None,
289
294
  which turns off HNSW search.
295
+ create_engine_kwargs (Optional[Dict[str, Any]], optional): Engine parameters to pass to create_engine. Defaults to None.
290
296
 
291
297
  Returns:
292
298
  PGVectorStore: Instance of PGVectorStore constructed from params.
@@ -311,6 +317,7 @@ class PGVectorStore(BasePydanticVectorStore):
311
317
  debug=debug,
312
318
  use_jsonb=use_jsonb,
313
319
  hnsw_kwargs=hnsw_kwargs,
320
+ create_engine_kwargs=create_engine_kwargs,
314
321
  )
315
322
 
316
323
  @property
@@ -324,10 +331,14 @@ class PGVectorStore(BasePydanticVectorStore):
324
331
  from sqlalchemy.ext.asyncio import AsyncSession, create_async_engine
325
332
  from sqlalchemy.orm import sessionmaker
326
333
 
327
- self._engine = create_engine(self.connection_string, echo=self.debug)
334
+ self._engine = create_engine(
335
+ self.connection_string, echo=self.debug, **self.create_engine_kwargs
336
+ )
328
337
  self._session = sessionmaker(self._engine)
329
338
 
330
- self._async_engine = create_async_engine(self.async_connection_string)
339
+ self._async_engine = create_async_engine(
340
+ self.async_connection_string, **self.create_engine_kwargs
341
+ )
331
342
  self._async_session = sessionmaker(self._async_engine, class_=AsyncSession) # type: ignore
332
343
 
333
344
  def _create_schema_if_not_exists(self) -> None:
@@ -27,7 +27,7 @@ exclude = ["**/BUILD"]
27
27
  license = "MIT"
28
28
  name = "llama-index-vector-stores-postgres"
29
29
  readme = "README.md"
30
- version = "0.2.2"
30
+ version = "0.2.3"
31
31
 
32
32
  [tool.poetry.dependencies]
33
33
  python = ">=3.8.1,<4.0"