pgvector-haystack 5.2.0__py3-none-any.whl → 5.3.0__py3-none-any.whl
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.
- haystack_integrations/document_stores/pgvector/document_store.py +34 -0
- {pgvector_haystack-5.2.0.dist-info → pgvector_haystack-5.3.0.dist-info}/METADATA +7 -25
- {pgvector_haystack-5.2.0.dist-info → pgvector_haystack-5.3.0.dist-info}/RECORD +5 -5
- {pgvector_haystack-5.2.0.dist-info → pgvector_haystack-5.3.0.dist-info}/WHEEL +0 -0
- {pgvector_haystack-5.2.0.dist-info → pgvector_haystack-5.3.0.dist-info}/licenses/LICENSE.txt +0 -0
|
@@ -534,6 +534,7 @@ class PgvectorDocumentStore:
|
|
|
534
534
|
The name of the schema (`schema_name`) and the name of the table (`table_name`)
|
|
535
535
|
are defined when initializing the `PgvectorDocumentStore`.
|
|
536
536
|
"""
|
|
537
|
+
self._ensure_db_setup()
|
|
537
538
|
delete_sql = SQL("DROP TABLE IF EXISTS {schema_name}.{table_name}").format(
|
|
538
539
|
schema_name=Identifier(self.schema_name),
|
|
539
540
|
table_name=Identifier(self.table_name),
|
|
@@ -551,6 +552,7 @@ class PgvectorDocumentStore:
|
|
|
551
552
|
"""
|
|
552
553
|
Async method to delete the table used to store Haystack documents.
|
|
553
554
|
"""
|
|
555
|
+
await self._ensure_db_setup_async()
|
|
554
556
|
delete_sql = SQL("DROP TABLE IF EXISTS {schema_name}.{table_name}").format(
|
|
555
557
|
schema_name=Identifier(self.schema_name),
|
|
556
558
|
table_name=Identifier(self.table_name),
|
|
@@ -985,6 +987,38 @@ class PgvectorDocumentStore:
|
|
|
985
987
|
error_msg="Could not delete documents from PgvectorDocumentStore",
|
|
986
988
|
)
|
|
987
989
|
|
|
990
|
+
def delete_all_documents(self) -> None:
|
|
991
|
+
"""
|
|
992
|
+
Deletes all documents in the document store.
|
|
993
|
+
"""
|
|
994
|
+
query = SQL("TRUNCATE TABLE {schema_name}.{table_name}").format(
|
|
995
|
+
schema_name=Identifier(self.schema_name),
|
|
996
|
+
table_name=Identifier(self.table_name),
|
|
997
|
+
)
|
|
998
|
+
|
|
999
|
+
self._ensure_db_setup()
|
|
1000
|
+
assert self._cursor is not None
|
|
1001
|
+
self._execute_sql(
|
|
1002
|
+
cursor=self._cursor, sql_query=query, error_msg="Could not delete all documents from PgvectorDocumentStore"
|
|
1003
|
+
)
|
|
1004
|
+
|
|
1005
|
+
async def delete_all_documents_async(self) -> None:
|
|
1006
|
+
"""
|
|
1007
|
+
Asynchronously deletes all documents in the document store.
|
|
1008
|
+
"""
|
|
1009
|
+
query = SQL("TRUNCATE TABLE {schema_name}.{table_name}").format(
|
|
1010
|
+
schema_name=Identifier(self.schema_name),
|
|
1011
|
+
table_name=Identifier(self.table_name),
|
|
1012
|
+
)
|
|
1013
|
+
|
|
1014
|
+
await self._ensure_db_setup_async()
|
|
1015
|
+
assert self._async_cursor is not None
|
|
1016
|
+
await self._execute_sql_async(
|
|
1017
|
+
cursor=self._async_cursor,
|
|
1018
|
+
sql_query=query,
|
|
1019
|
+
error_msg="Could not delete all documents from PgvectorDocumentStore",
|
|
1020
|
+
)
|
|
1021
|
+
|
|
988
1022
|
def _build_keyword_retrieval_query(
|
|
989
1023
|
self, query: str, top_k: int, filters: Optional[Dict[str, Any]] = None
|
|
990
1024
|
) -> Tuple[Composed, tuple]:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pgvector-haystack
|
|
3
|
-
Version: 5.
|
|
3
|
+
Version: 5.3.0
|
|
4
4
|
Summary: An integration of pgvector (vector search extension for Postgres) with Haystack
|
|
5
5
|
Project-URL: Source, https://github.com/deepset-ai/haystack-core-integrations
|
|
6
6
|
Project-URL: Documentation, https://github.com/deepset-ai/haystack-core-integrations/blob/main/integrations/pgvector/README.md
|
|
@@ -29,34 +29,16 @@ Description-Content-Type: text/markdown
|
|
|
29
29
|
[](https://pypi.org/project/pgvector-haystack)
|
|
30
30
|
[](https://pypi.org/project/pgvector-haystack)
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
- [Integration page](https://haystack.deepset.ai/integrations/pgvector-documentstore)
|
|
33
|
+
- [Changelog](https://github.com/deepset-ai/haystack-core-integrations/blob/main/integrations/pgvector/CHANGELOG.md)
|
|
33
34
|
|
|
34
|
-
|
|
35
|
+
---
|
|
35
36
|
|
|
36
|
-
|
|
37
|
-
- [Installation](#installation)
|
|
38
|
-
- [Testing](#testing)
|
|
39
|
-
- [License](#license)
|
|
37
|
+
Refer to the general [Contribution Guidelines](https://github.com/deepset-ai/haystack-core-integrations/blob/main/CONTRIBUTING.md).
|
|
40
38
|
|
|
41
|
-
|
|
39
|
+
To run integration tests locally, you need to have a PostgreSQL DB running with the `pgvector` extension.
|
|
40
|
+
You can start it using Docker:
|
|
42
41
|
|
|
43
42
|
```console
|
|
44
|
-
pip install pgvector-haystack
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
## Testing
|
|
48
|
-
|
|
49
|
-
Ensure that you have a PostgreSQL running with the `pgvector` extension. For a quick setup using Docker, run:
|
|
50
|
-
```
|
|
51
43
|
docker run -d -p 5432:5432 -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=postgres pgvector/pgvector:pg17
|
|
52
44
|
```
|
|
53
|
-
|
|
54
|
-
then run the tests:
|
|
55
|
-
|
|
56
|
-
```console
|
|
57
|
-
hatch run test:all
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
## License
|
|
61
|
-
|
|
62
|
-
`pgvector-haystack` is distributed under the terms of the [Apache-2.0](https://spdx.org/licenses/Apache-2.0.html) license.
|
|
@@ -5,9 +5,9 @@ haystack_integrations/components/retrievers/pgvector/keyword_retriever.py,sha256
|
|
|
5
5
|
haystack_integrations/document_stores/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
6
|
haystack_integrations/document_stores/pgvector/__init__.py,sha256=Ge-7ggarfr3x8UqNdFHUuFGiu52u49sOVe3l16WEwZU,197
|
|
7
7
|
haystack_integrations/document_stores/pgvector/converters.py,sha256=9ORG_Yb8Ss4eGGJB9ZGaDE25z89rLAh3ZisKwRww1bw,2937
|
|
8
|
-
haystack_integrations/document_stores/pgvector/document_store.py,sha256=
|
|
8
|
+
haystack_integrations/document_stores/pgvector/document_store.py,sha256=EKrDg-nezEaRhEYnVhlTH7wmJ_w4sy5IfaaNq6mITaY,51009
|
|
9
9
|
haystack_integrations/document_stores/pgvector/filters.py,sha256=jYdoXJZhAn3hNZTnx1x8K5Ok2LZzh-GB4hOhk6r7ZPk,9021
|
|
10
|
-
pgvector_haystack-5.
|
|
11
|
-
pgvector_haystack-5.
|
|
12
|
-
pgvector_haystack-5.
|
|
13
|
-
pgvector_haystack-5.
|
|
10
|
+
pgvector_haystack-5.3.0.dist-info/METADATA,sha256=O_edb8lqV2SEZqbwb6Va_iC3Pu_p0GtxM_t95SEPNGo,2144
|
|
11
|
+
pgvector_haystack-5.3.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
12
|
+
pgvector_haystack-5.3.0.dist-info/licenses/LICENSE.txt,sha256=B05uMshqTA74s-0ltyHKI6yoPfJ3zYgQbvcXfDVGFf8,10280
|
|
13
|
+
pgvector_haystack-5.3.0.dist-info/RECORD,,
|
|
File without changes
|
{pgvector_haystack-5.2.0.dist-info → pgvector_haystack-5.3.0.dist-info}/licenses/LICENSE.txt
RENAMED
|
File without changes
|