llama-index-vector-stores-postgres 0.2.2__tar.gz → 0.2.4__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.4
4
4
  Summary: llama-index vector_stores postgres integration
5
5
  License: MIT
6
6
  Author: Your Name
@@ -148,6 +148,7 @@ class PGVectorStore(BasePydanticVectorStore):
148
148
  perform_setup: bool
149
149
  debug: bool
150
150
  use_jsonb: bool
151
+ create_engine_kwargs: Dict
151
152
 
152
153
  hnsw_kwargs: Optional[Dict[str, Any]]
153
154
 
@@ -173,6 +174,7 @@ class PGVectorStore(BasePydanticVectorStore):
173
174
  debug: bool = False,
174
175
  use_jsonb: bool = False,
175
176
  hnsw_kwargs: Optional[Dict[str, Any]] = None,
177
+ create_engine_kwargs: Optional[Dict[str, Any]] = None,
176
178
  ) -> None:
177
179
  """Constructor.
178
180
 
@@ -191,6 +193,7 @@ class PGVectorStore(BasePydanticVectorStore):
191
193
  hnsw_kwargs (Optional[Dict[str, Any]], optional): HNSW kwargs, a dict that
192
194
  contains "hnsw_ef_construction", "hnsw_ef_search", "hnsw_m", and optionally "hnsw_dist_method". Defaults to None,
193
195
  which turns off HNSW search.
196
+ create_engine_kwargs (Optional[Dict[str, Any]], optional): Engine parameters to pass to create_engine. Defaults to None.
194
197
  """
195
198
  table_name = table_name.lower()
196
199
  schema_name = schema_name.lower()
@@ -216,6 +219,7 @@ class PGVectorStore(BasePydanticVectorStore):
216
219
  debug=debug,
217
220
  use_jsonb=use_jsonb,
218
221
  hnsw_kwargs=hnsw_kwargs,
222
+ create_engine_kwargs=create_engine_kwargs or {},
219
223
  )
220
224
 
221
225
  # sqlalchemy model
@@ -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.4"
31
31
 
32
32
  [tool.poetry.dependencies]
33
33
  python = ">=3.8.1,<4.0"