pgvector-haystack 5.2.1__tar.gz → 5.3.0__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.
Files changed (28) hide show
  1. {pgvector_haystack-5.2.1 → pgvector_haystack-5.3.0}/CHANGELOG.md +6 -3
  2. {pgvector_haystack-5.2.1 → pgvector_haystack-5.3.0}/PKG-INFO +7 -25
  3. pgvector_haystack-5.3.0/README.md +18 -0
  4. {pgvector_haystack-5.2.1 → pgvector_haystack-5.3.0}/src/haystack_integrations/document_stores/pgvector/document_store.py +32 -0
  5. {pgvector_haystack-5.2.1 → pgvector_haystack-5.3.0}/tests/test_document_store.py +7 -0
  6. {pgvector_haystack-5.2.1 → pgvector_haystack-5.3.0}/tests/test_document_store_async.py +7 -0
  7. pgvector_haystack-5.2.1/README.md +0 -36
  8. {pgvector_haystack-5.2.1 → pgvector_haystack-5.3.0}/.gitignore +0 -0
  9. {pgvector_haystack-5.2.1 → pgvector_haystack-5.3.0}/LICENSE.txt +0 -0
  10. {pgvector_haystack-5.2.1 → pgvector_haystack-5.3.0}/examples/embedding_retrieval.py +0 -0
  11. {pgvector_haystack-5.2.1 → pgvector_haystack-5.3.0}/examples/hybrid_retrieval.py +0 -0
  12. {pgvector_haystack-5.2.1 → pgvector_haystack-5.3.0}/pydoc/config.yml +0 -0
  13. {pgvector_haystack-5.2.1 → pgvector_haystack-5.3.0}/pyproject.toml +0 -0
  14. {pgvector_haystack-5.2.1 → pgvector_haystack-5.3.0}/src/haystack_integrations/components/retrievers/pgvector/__init__.py +0 -0
  15. {pgvector_haystack-5.2.1 → pgvector_haystack-5.3.0}/src/haystack_integrations/components/retrievers/pgvector/embedding_retriever.py +0 -0
  16. {pgvector_haystack-5.2.1 → pgvector_haystack-5.3.0}/src/haystack_integrations/components/retrievers/pgvector/keyword_retriever.py +0 -0
  17. {pgvector_haystack-5.2.1 → pgvector_haystack-5.3.0}/src/haystack_integrations/components/retrievers/py.typed +0 -0
  18. {pgvector_haystack-5.2.1 → pgvector_haystack-5.3.0}/src/haystack_integrations/document_stores/pgvector/__init__.py +0 -0
  19. {pgvector_haystack-5.2.1 → pgvector_haystack-5.3.0}/src/haystack_integrations/document_stores/pgvector/converters.py +0 -0
  20. {pgvector_haystack-5.2.1 → pgvector_haystack-5.3.0}/src/haystack_integrations/document_stores/pgvector/filters.py +0 -0
  21. {pgvector_haystack-5.2.1 → pgvector_haystack-5.3.0}/src/haystack_integrations/document_stores/py.typed +0 -0
  22. {pgvector_haystack-5.2.1 → pgvector_haystack-5.3.0}/tests/__init__.py +0 -0
  23. {pgvector_haystack-5.2.1 → pgvector_haystack-5.3.0}/tests/conftest.py +0 -0
  24. {pgvector_haystack-5.2.1 → pgvector_haystack-5.3.0}/tests/test_converters.py +0 -0
  25. {pgvector_haystack-5.2.1 → pgvector_haystack-5.3.0}/tests/test_filters.py +0 -0
  26. {pgvector_haystack-5.2.1 → pgvector_haystack-5.3.0}/tests/test_retrieval.py +0 -0
  27. {pgvector_haystack-5.2.1 → pgvector_haystack-5.3.0}/tests/test_retrieval_async.py +0 -0
  28. {pgvector_haystack-5.2.1 → pgvector_haystack-5.3.0}/tests/test_retrievers.py +0 -0
@@ -1,13 +1,16 @@
1
1
  # Changelog
2
2
 
3
- ## [integrations/pgvector-v5.2.0] - 2025-06-26
3
+ ## [integrations/pgvector-v5.2.1] - 2025-07-03
4
+
5
+ ### 🐛 Bug Fixes
6
+
7
+ - Pgvector - ensure DB is initialized when calling `delete_table` (#2055)
4
8
 
5
- Note: Version 5.2.0 was released by mistake.
6
- It is functionally identical to version 3.4.1 and does not introduce any new features or changes.
7
9
 
8
10
  ### 🧹 Chores
9
11
 
10
12
  - Remove black (#1985)
13
+ - Pgvector - update docker image in examples (#1995)
11
14
 
12
15
 
13
16
  ## [integrations/pgvector-v3.4.1] - 2025-06-20
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pgvector-haystack
3
- Version: 5.2.1
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
  [![PyPI - Version](https://img.shields.io/pypi/v/pgvector-haystack.svg)](https://pypi.org/project/pgvector-haystack)
30
30
  [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pgvector-haystack.svg)](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
- **Table of Contents**
35
+ ---
35
36
 
36
- - [pgvector-haystack](#pgvector-haystack)
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
- ## Installation
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.
@@ -0,0 +1,18 @@
1
+ # pgvector-haystack
2
+
3
+ [![PyPI - Version](https://img.shields.io/pypi/v/pgvector-haystack.svg)](https://pypi.org/project/pgvector-haystack)
4
+ [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pgvector-haystack.svg)](https://pypi.org/project/pgvector-haystack)
5
+
6
+ - [Integration page](https://haystack.deepset.ai/integrations/pgvector-documentstore)
7
+ - [Changelog](https://github.com/deepset-ai/haystack-core-integrations/blob/main/integrations/pgvector/CHANGELOG.md)
8
+
9
+ ---
10
+
11
+ Refer to the general [Contribution Guidelines](https://github.com/deepset-ai/haystack-core-integrations/blob/main/CONTRIBUTING.md).
12
+
13
+ To run integration tests locally, you need to have a PostgreSQL DB running with the `pgvector` extension.
14
+ You can start it using Docker:
15
+
16
+ ```console
17
+ docker run -d -p 5432:5432 -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=postgres pgvector/pgvector:pg17
18
+ ```
@@ -987,6 +987,38 @@ class PgvectorDocumentStore:
987
987
  error_msg="Could not delete documents from PgvectorDocumentStore",
988
988
  )
989
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
+
990
1022
  def _build_keyword_retrieval_query(
991
1023
  self, query: str, top_k: int, filters: Optional[Dict[str, Any]] = None
992
1024
  ) -> Tuple[Composed, tuple]:
@@ -53,6 +53,13 @@ class TestDocumentStore(CountDocumentsTest, WriteDocumentsTest, DeleteDocumentsT
53
53
  same_connection = document_store._connection
54
54
  assert same_connection is document_store._connection
55
55
 
56
+ def test_delete_all_documents(self, document_store: PgvectorDocumentStore) -> None:
57
+ document_store.write_documents([Document(id=str(i)) for i in range(10)])
58
+ document_store.delete_all_documents()
59
+ assert document_store.count_documents() == 0
60
+ document_store.write_documents([Document(id="1")])
61
+ assert document_store.count_documents() == 1
62
+
56
63
 
57
64
  @pytest.mark.usefixtures("patches_for_unit_tests")
58
65
  def test_init(monkeypatch):
@@ -94,6 +94,13 @@ class TestDocumentStoreAsync:
94
94
  same_connection = document_store._async_connection
95
95
  assert same_connection is document_store._async_connection
96
96
 
97
+ async def test_delete_all_documents_async(self, document_store: PgvectorDocumentStore) -> None:
98
+ document_store.write_documents([Document(id=str(i)) for i in range(10)])
99
+ await document_store.delete_all_documents_async()
100
+ assert document_store.count_documents() == 0
101
+ document_store.write_documents([Document(id="1")])
102
+ assert document_store.count_documents() == 1
103
+
97
104
 
98
105
  @pytest.mark.integration
99
106
  @pytest.mark.asyncio
@@ -1,36 +0,0 @@
1
- # pgvector-haystack
2
-
3
- [![PyPI - Version](https://img.shields.io/pypi/v/pgvector-haystack.svg)](https://pypi.org/project/pgvector-haystack)
4
- [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pgvector-haystack.svg)](https://pypi.org/project/pgvector-haystack)
5
-
6
- ---
7
-
8
- **Table of Contents**
9
-
10
- - [pgvector-haystack](#pgvector-haystack)
11
- - [Installation](#installation)
12
- - [Testing](#testing)
13
- - [License](#license)
14
-
15
- ## Installation
16
-
17
- ```console
18
- pip install pgvector-haystack
19
- ```
20
-
21
- ## Testing
22
-
23
- Ensure that you have a PostgreSQL running with the `pgvector` extension. For a quick setup using Docker, run:
24
- ```
25
- docker run -d -p 5432:5432 -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=postgres pgvector/pgvector:pg17
26
- ```
27
-
28
- then run the tests:
29
-
30
- ```console
31
- hatch run test:all
32
- ```
33
-
34
- ## License
35
-
36
- `pgvector-haystack` is distributed under the terms of the [Apache-2.0](https://spdx.org/licenses/Apache-2.0.html) license.