llama-index-vector-stores-postgres 0.2.1__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.
- {llama_index_vector_stores_postgres-0.2.1 → llama_index_vector_stores_postgres-0.2.3}/PKG-INFO +2 -1
- {llama_index_vector_stores_postgres-0.2.1 → llama_index_vector_stores_postgres-0.2.3}/llama_index/vector_stores/postgres/base.py +16 -5
- {llama_index_vector_stores_postgres-0.2.1 → llama_index_vector_stores_postgres-0.2.3}/pyproject.toml +1 -1
- {llama_index_vector_stores_postgres-0.2.1 → llama_index_vector_stores_postgres-0.2.3}/README.md +0 -0
- {llama_index_vector_stores_postgres-0.2.1 → llama_index_vector_stores_postgres-0.2.3}/llama_index/py.typed +0 -0
- {llama_index_vector_stores_postgres-0.2.1 → llama_index_vector_stores_postgres-0.2.3}/llama_index/vector_stores/postgres/__init__.py +0 -0
{llama_index_vector_stores_postgres-0.2.1 → llama_index_vector_stores_postgres-0.2.3}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: llama-index-vector-stores-postgres
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.3
|
|
4
4
|
Summary: llama-index vector_stores postgres integration
|
|
5
5
|
License: MIT
|
|
6
6
|
Author: Your Name
|
|
@@ -11,6 +11,7 @@ Classifier: Programming Language :: Python :: 3
|
|
|
11
11
|
Classifier: Programming Language :: Python :: 3.9
|
|
12
12
|
Classifier: Programming Language :: Python :: 3.10
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
15
|
Requires-Dist: asyncpg (>=0.29.0,<0.30.0)
|
|
15
16
|
Requires-Dist: llama-index-core (>=0.11.0,<0.12.0)
|
|
16
17
|
Requires-Dist: pgvector (>=0.2.4,<0.3.0)
|
|
@@ -138,7 +138,7 @@ class PGVectorStore(BasePydanticVectorStore):
|
|
|
138
138
|
flat_metadata: bool = False
|
|
139
139
|
|
|
140
140
|
connection_string: str
|
|
141
|
-
async_connection_string:
|
|
141
|
+
async_connection_string: str
|
|
142
142
|
table_name: str
|
|
143
143
|
schema_name: str
|
|
144
144
|
embed_dim: int
|
|
@@ -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()
|
|
@@ -204,8 +206,8 @@ class PGVectorStore(BasePydanticVectorStore):
|
|
|
204
206
|
from sqlalchemy.orm import declarative_base
|
|
205
207
|
|
|
206
208
|
super().__init__(
|
|
207
|
-
connection_string=connection_string,
|
|
208
|
-
async_connection_string=async_connection_string,
|
|
209
|
+
connection_string=str(connection_string),
|
|
210
|
+
async_connection_string=str(async_connection_string),
|
|
209
211
|
table_name=table_name,
|
|
210
212
|
schema_name=schema_name,
|
|
211
213
|
hybrid_search=hybrid_search,
|
|
@@ -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(
|
|
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(
|
|
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:
|
{llama_index_vector_stores_postgres-0.2.1 → llama_index_vector_stores_postgres-0.2.3}/README.md
RENAMED
|
File without changes
|
|
File without changes
|