llama-index-vector-stores-postgres 0.3.1__tar.gz → 0.3.2__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.
- {llama_index_vector_stores_postgres-0.3.1 → llama_index_vector_stores_postgres-0.3.2}/PKG-INFO +1 -1
- {llama_index_vector_stores_postgres-0.3.1 → llama_index_vector_stores_postgres-0.3.2}/llama_index/vector_stores/postgres/base.py +28 -7
- {llama_index_vector_stores_postgres-0.3.1 → llama_index_vector_stores_postgres-0.3.2}/pyproject.toml +1 -1
- {llama_index_vector_stores_postgres-0.3.1 → llama_index_vector_stores_postgres-0.3.2}/README.md +0 -0
- {llama_index_vector_stores_postgres-0.3.1 → llama_index_vector_stores_postgres-0.3.2}/llama_index/py.typed +0 -0
- {llama_index_vector_stores_postgres-0.3.1 → llama_index_vector_stores_postgres-0.3.2}/llama_index/vector_stores/postgres/__init__.py +0 -0
|
@@ -149,6 +149,7 @@ class PGVectorStore(BasePydanticVectorStore):
|
|
|
149
149
|
debug: bool
|
|
150
150
|
use_jsonb: bool
|
|
151
151
|
create_engine_kwargs: Dict
|
|
152
|
+
initialization_fail_on_error: bool = False
|
|
152
153
|
|
|
153
154
|
hnsw_kwargs: Optional[Dict[str, Any]]
|
|
154
155
|
|
|
@@ -175,6 +176,7 @@ class PGVectorStore(BasePydanticVectorStore):
|
|
|
175
176
|
use_jsonb: bool = False,
|
|
176
177
|
hnsw_kwargs: Optional[Dict[str, Any]] = None,
|
|
177
178
|
create_engine_kwargs: Optional[Dict[str, Any]] = None,
|
|
179
|
+
initialization_fail_on_error: bool = False,
|
|
178
180
|
) -> None:
|
|
179
181
|
"""Constructor.
|
|
180
182
|
|
|
@@ -220,6 +222,7 @@ class PGVectorStore(BasePydanticVectorStore):
|
|
|
220
222
|
use_jsonb=use_jsonb,
|
|
221
223
|
hnsw_kwargs=hnsw_kwargs,
|
|
222
224
|
create_engine_kwargs=create_engine_kwargs or {},
|
|
225
|
+
initialization_fail_on_error=initialization_fail_on_error,
|
|
223
226
|
)
|
|
224
227
|
|
|
225
228
|
# sqlalchemy model
|
|
@@ -405,17 +408,35 @@ class PGVectorStore(BasePydanticVectorStore):
|
|
|
405
408
|
session.commit()
|
|
406
409
|
|
|
407
410
|
def _initialize(self) -> None:
|
|
411
|
+
fail_on_error = self.initialization_fail_on_error
|
|
408
412
|
if not self._is_initialized:
|
|
409
413
|
self._connect()
|
|
410
414
|
if self.perform_setup:
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
415
|
+
try:
|
|
416
|
+
self._create_schema_if_not_exists()
|
|
417
|
+
except Exception as e:
|
|
418
|
+
_logger.warning(f"PG Setup: Error creating schema: {e}")
|
|
419
|
+
if fail_on_error:
|
|
420
|
+
raise
|
|
421
|
+
try:
|
|
422
|
+
self._create_extension()
|
|
423
|
+
except Exception as e:
|
|
424
|
+
_logger.warning(f"PG Setup: Error creating extension: {e}")
|
|
425
|
+
if fail_on_error:
|
|
426
|
+
raise
|
|
427
|
+
try:
|
|
428
|
+
self._create_tables_if_not_exists()
|
|
429
|
+
except Exception as e:
|
|
430
|
+
_logger.warning(f"PG Setup: Error creating tables: {e}")
|
|
431
|
+
if fail_on_error:
|
|
432
|
+
raise
|
|
417
433
|
if self.hnsw_kwargs is not None:
|
|
418
|
-
|
|
434
|
+
try:
|
|
435
|
+
self._create_hnsw_index()
|
|
436
|
+
except Exception as e:
|
|
437
|
+
_logger.warning(f"PG Setup: Error creating HNSW index: {e}")
|
|
438
|
+
if fail_on_error:
|
|
439
|
+
raise
|
|
419
440
|
self._is_initialized = True
|
|
420
441
|
|
|
421
442
|
def _node_to_table_row(self, node: BaseNode) -> Any:
|
{llama_index_vector_stores_postgres-0.3.1 → llama_index_vector_stores_postgres-0.3.2}/README.md
RENAMED
|
File without changes
|
|
File without changes
|