pgvector-haystack 1.1.0__tar.gz → 1.2.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 (23) hide show
  1. pgvector_haystack-1.2.0/CHANGELOG.md +96 -0
  2. {pgvector_haystack-1.1.0 → pgvector_haystack-1.2.0}/PKG-INFO +1 -1
  3. {pgvector_haystack-1.1.0 → pgvector_haystack-1.2.0}/src/haystack_integrations/document_stores/pgvector/document_store.py +9 -1
  4. {pgvector_haystack-1.1.0 → pgvector_haystack-1.2.0}/tests/test_document_store.py +4 -0
  5. {pgvector_haystack-1.1.0 → pgvector_haystack-1.2.0}/tests/test_retrievers.py +6 -0
  6. pgvector_haystack-1.1.0/CHANGELOG.md +0 -56
  7. {pgvector_haystack-1.1.0 → pgvector_haystack-1.2.0}/.gitignore +0 -0
  8. {pgvector_haystack-1.1.0 → pgvector_haystack-1.2.0}/LICENSE.txt +0 -0
  9. {pgvector_haystack-1.1.0 → pgvector_haystack-1.2.0}/README.md +0 -0
  10. {pgvector_haystack-1.1.0 → pgvector_haystack-1.2.0}/examples/embedding_retrieval.py +0 -0
  11. {pgvector_haystack-1.1.0 → pgvector_haystack-1.2.0}/examples/hybrid_retrieval.py +0 -0
  12. {pgvector_haystack-1.1.0 → pgvector_haystack-1.2.0}/pydoc/config.yml +0 -0
  13. {pgvector_haystack-1.1.0 → pgvector_haystack-1.2.0}/pyproject.toml +0 -0
  14. {pgvector_haystack-1.1.0 → pgvector_haystack-1.2.0}/src/haystack_integrations/components/retrievers/pgvector/__init__.py +0 -0
  15. {pgvector_haystack-1.1.0 → pgvector_haystack-1.2.0}/src/haystack_integrations/components/retrievers/pgvector/embedding_retriever.py +0 -0
  16. {pgvector_haystack-1.1.0 → pgvector_haystack-1.2.0}/src/haystack_integrations/components/retrievers/pgvector/keyword_retriever.py +0 -0
  17. {pgvector_haystack-1.1.0 → pgvector_haystack-1.2.0}/src/haystack_integrations/document_stores/pgvector/__init__.py +0 -0
  18. {pgvector_haystack-1.1.0 → pgvector_haystack-1.2.0}/src/haystack_integrations/document_stores/pgvector/filters.py +0 -0
  19. {pgvector_haystack-1.1.0 → pgvector_haystack-1.2.0}/tests/__init__.py +0 -0
  20. {pgvector_haystack-1.1.0 → pgvector_haystack-1.2.0}/tests/conftest.py +0 -0
  21. {pgvector_haystack-1.1.0 → pgvector_haystack-1.2.0}/tests/test_embedding_retrieval.py +0 -0
  22. {pgvector_haystack-1.1.0 → pgvector_haystack-1.2.0}/tests/test_filters.py +0 -0
  23. {pgvector_haystack-1.1.0 → pgvector_haystack-1.2.0}/tests/test_keyword_retrieval.py +0 -0
@@ -0,0 +1,96 @@
1
+ # Changelog
2
+
3
+ ## [integrations/pgvector-v1.1.0] - 2024-11-21
4
+
5
+ ### 🚀 Features
6
+
7
+ - Add filter_policy to pgvector integration (#820)
8
+ - Add schema support to pgvector document store. (#1095)
9
+ - Pgvector - recreate the connection if it is no longer valid (#1202)
10
+
11
+ ### 🐛 Bug Fixes
12
+
13
+ - `PgVector` - Fallback to default filter policy when deserializing retrievers without the init parameter (#900)
14
+
15
+ ### 📚 Documentation
16
+
17
+ - Explain different connection string formats in the docstring (#1132)
18
+
19
+ ### 🧪 Testing
20
+
21
+ - Do not retry tests in `hatch run test` command (#954)
22
+
23
+ ### ⚙️ CI
24
+
25
+ - Retry tests to reduce flakyness (#836)
26
+ - Adopt uv as installer (#1142)
27
+
28
+ ### 🧹 Chores
29
+
30
+ - Update ruff invocation to include check parameter (#853)
31
+ - PgVector - remove legacy filter support (#1068)
32
+ - Update changelog after removing legacy filters (#1083)
33
+ - Update ruff linting scripts and settings (#1105)
34
+
35
+ ### 🌀 Miscellaneous
36
+
37
+ - Ci: install `pytest-rerunfailures` where needed; add retry config to `test-cov` script (#845)
38
+ - Chore: Minor retriever pydoc fix (#884)
39
+ - Chore: Update pgvector test for the new `apply_filter_policy` usage (#970)
40
+ - Chore: pgvector ruff update, don't ruff tests (#984)
41
+
42
+ ## [integrations/pgvector-v0.4.0] - 2024-06-20
43
+
44
+ ### 🚀 Features
45
+
46
+ - Defer the database connection to when it's needed (#773)
47
+ - Add customizable index names for pgvector (#818)
48
+
49
+ ### 🌀 Miscellaneous
50
+
51
+ - Docs: add missing api references (#728)
52
+ - [deepset-ai/haystack-core-integrations#727] (#738)
53
+
54
+ ## [integrations/pgvector-v0.2.0] - 2024-05-08
55
+
56
+ ### 🚀 Features
57
+
58
+ - `MongoDBAtlasEmbeddingRetriever` (#427)
59
+ - Implement keyword retrieval for pgvector integration (#644)
60
+
61
+ ### 🐛 Bug Fixes
62
+
63
+ - Fix order of API docs (#447)
64
+
65
+ ### 📚 Documentation
66
+
67
+ - Update category slug (#442)
68
+ - Disable-class-def (#556)
69
+
70
+ ### 🌀 Miscellaneous
71
+
72
+ - Pgvector - review docstrings and API reference (#502)
73
+ - Refactor tests (#574)
74
+ - Remove references to Python 3.7 (#601)
75
+ - Make Document Stores initially skip `SparseEmbedding` (#606)
76
+ - Chore: add license classifiers (#680)
77
+ - Type hints in pgvector document store updated for 3.8 compability (#704)
78
+ - Chore: change the pydoc renderer class (#718)
79
+
80
+ ## [integrations/pgvector-v0.1.0] - 2024-02-14
81
+
82
+ ### 🐛 Bug Fixes
83
+
84
+ - Pgvector: fix linting (#328)
85
+
86
+ ### 🌀 Miscellaneous
87
+
88
+ - Pgvector Document Store - minimal implementation (#239)
89
+ - Pgvector - filters (#257)
90
+ - Pgvector - embedding retrieval (#298)
91
+ - Pgvector - Embedding Retriever (#320)
92
+ - Pgvector: generate API docs (#325)
93
+ - Pgvector: add an example (#334)
94
+ - Adopt `Secret` to pgvector (#402)
95
+
96
+ <!-- generated by git-cliff -->
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pgvector-haystack
3
- Version: 1.1.0
3
+ Version: 1.2.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
@@ -78,6 +78,7 @@ class PgvectorDocumentStore:
78
78
  self,
79
79
  *,
80
80
  connection_string: Secret = Secret.from_env_var("PG_CONN_STR"),
81
+ create_extension: bool = True,
81
82
  schema_name: str = "public",
82
83
  table_name: str = "haystack_documents",
83
84
  language: str = "english",
@@ -102,6 +103,10 @@ class PgvectorDocumentStore:
102
103
  e.g.: `PG_CONN_STR="host=HOST port=PORT dbname=DBNAME user=USER password=PASSWORD"`
103
104
  See [PostgreSQL Documentation](https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING)
104
105
  for more details.
106
+ :param create_extension: Whether to create the pgvector extension if it doesn't exist.
107
+ Set this to `True` (default) to automatically create the extension if it is missing.
108
+ Creating the extension may require superuser privileges.
109
+ If set to `False`, ensure the extension is already installed; otherwise, an error will be raised.
105
110
  :param schema_name: The name of the schema the table is created in. The schema must already exist.
106
111
  :param table_name: The name of the table to use to store Haystack documents.
107
112
  :param language: The language to be used to parse query and document content in keyword retrieval.
@@ -138,6 +143,7 @@ class PgvectorDocumentStore:
138
143
  """
139
144
 
140
145
  self.connection_string = connection_string
146
+ self.create_extension = create_extension
141
147
  self.table_name = table_name
142
148
  self.schema_name = schema_name
143
149
  self.embedding_dimension = embedding_dimension
@@ -194,7 +200,8 @@ class PgvectorDocumentStore:
194
200
  conn_str = self.connection_string.resolve_value() or ""
195
201
  connection = connect(conn_str)
196
202
  connection.autocommit = True
197
- connection.execute("CREATE EXTENSION IF NOT EXISTS vector")
203
+ if self.create_extension:
204
+ connection.execute("CREATE EXTENSION IF NOT EXISTS vector")
198
205
  register_vector(connection) # Note: this must be called before creating the cursors.
199
206
 
200
207
  self._connection = connection
@@ -246,6 +253,7 @@ class PgvectorDocumentStore:
246
253
  return default_to_dict(
247
254
  self,
248
255
  connection_string=self.connection_string.to_dict(),
256
+ create_extension=self.create_extension,
249
257
  schema_name=self.schema_name,
250
258
  table_name=self.table_name,
251
259
  embedding_dimension=self.embedding_dimension,
@@ -66,6 +66,7 @@ def test_init(monkeypatch):
66
66
  monkeypatch.setenv("PG_CONN_STR", "some_connection_string")
67
67
 
68
68
  document_store = PgvectorDocumentStore(
69
+ create_extension=True,
69
70
  schema_name="my_schema",
70
71
  table_name="my_table",
71
72
  embedding_dimension=512,
@@ -79,6 +80,7 @@ def test_init(monkeypatch):
79
80
  keyword_index_name="my_keyword_index",
80
81
  )
81
82
 
83
+ assert document_store.create_extension
82
84
  assert document_store.schema_name == "my_schema"
83
85
  assert document_store.table_name == "my_table"
84
86
  assert document_store.embedding_dimension == 512
@@ -97,6 +99,7 @@ def test_to_dict(monkeypatch):
97
99
  monkeypatch.setenv("PG_CONN_STR", "some_connection_string")
98
100
 
99
101
  document_store = PgvectorDocumentStore(
102
+ create_extension=False,
100
103
  table_name="my_table",
101
104
  embedding_dimension=512,
102
105
  vector_function="l2_distance",
@@ -113,6 +116,7 @@ def test_to_dict(monkeypatch):
113
116
  "type": "haystack_integrations.document_stores.pgvector.document_store.PgvectorDocumentStore",
114
117
  "init_parameters": {
115
118
  "connection_string": {"env_vars": ["PG_CONN_STR"], "strict": True, "type": "env_var"},
119
+ "create_extension": False,
116
120
  "table_name": "my_table",
117
121
  "schema_name": "public",
118
122
  "embedding_dimension": 512,
@@ -50,6 +50,7 @@ class TestEmbeddingRetriever:
50
50
  "type": "haystack_integrations.document_stores.pgvector.document_store.PgvectorDocumentStore",
51
51
  "init_parameters": {
52
52
  "connection_string": {"env_vars": ["PG_CONN_STR"], "strict": True, "type": "env_var"},
53
+ "create_extension": True,
53
54
  "schema_name": "public",
54
55
  "table_name": "haystack",
55
56
  "embedding_dimension": 768,
@@ -82,6 +83,7 @@ class TestEmbeddingRetriever:
82
83
  "type": "haystack_integrations.document_stores.pgvector.document_store.PgvectorDocumentStore",
83
84
  "init_parameters": {
84
85
  "connection_string": {"env_vars": ["PG_CONN_STR"], "strict": True, "type": "env_var"},
86
+ "create_extension": False,
85
87
  "table_name": "haystack_test_to_dict",
86
88
  "embedding_dimension": 768,
87
89
  "vector_function": "cosine_similarity",
@@ -106,6 +108,7 @@ class TestEmbeddingRetriever:
106
108
 
107
109
  assert isinstance(document_store, PgvectorDocumentStore)
108
110
  assert isinstance(document_store.connection_string, EnvVarSecret)
111
+ assert not document_store.create_extension
109
112
  assert document_store.table_name == "haystack_test_to_dict"
110
113
  assert document_store.embedding_dimension == 768
111
114
  assert document_store.vector_function == "cosine_similarity"
@@ -176,6 +179,7 @@ class TestKeywordRetriever:
176
179
  "type": "haystack_integrations.document_stores.pgvector.document_store.PgvectorDocumentStore",
177
180
  "init_parameters": {
178
181
  "connection_string": {"env_vars": ["PG_CONN_STR"], "strict": True, "type": "env_var"},
182
+ "create_extension": True,
179
183
  "schema_name": "public",
180
184
  "table_name": "haystack",
181
185
  "embedding_dimension": 768,
@@ -207,6 +211,7 @@ class TestKeywordRetriever:
207
211
  "type": "haystack_integrations.document_stores.pgvector.document_store.PgvectorDocumentStore",
208
212
  "init_parameters": {
209
213
  "connection_string": {"env_vars": ["PG_CONN_STR"], "strict": True, "type": "env_var"},
214
+ "create_extension": False,
210
215
  "table_name": "haystack_test_to_dict",
211
216
  "embedding_dimension": 768,
212
217
  "vector_function": "cosine_similarity",
@@ -230,6 +235,7 @@ class TestKeywordRetriever:
230
235
 
231
236
  assert isinstance(document_store, PgvectorDocumentStore)
232
237
  assert isinstance(document_store.connection_string, EnvVarSecret)
238
+ assert not document_store.create_extension
233
239
  assert document_store.table_name == "haystack_test_to_dict"
234
240
  assert document_store.embedding_dimension == 768
235
241
  assert document_store.vector_function == "cosine_similarity"
@@ -1,56 +0,0 @@
1
- # Changelog
2
-
3
- ## [integrations/pgvector-v1.0.0] - 2024-09-12
4
-
5
- ### 🚀 Features
6
-
7
- - Add filter_policy to pgvector integration (#820)
8
-
9
- ### 🐛 Bug Fixes
10
-
11
- - `PgVector` - Fallback to default filter policy when deserializing retrievers without the init parameter (#900)
12
-
13
- ### 🧪 Testing
14
-
15
- - Do not retry tests in `hatch run test` command (#954)
16
-
17
- ### ⚙️ Miscellaneous Tasks
18
-
19
- - Retry tests to reduce flakyness (#836)
20
- - Update ruff invocation to include check parameter (#853)
21
- - PgVector - remove legacy filter support (#1068)
22
-
23
- ## [integrations/pgvector-v0.4.0] - 2024-06-20
24
-
25
- ### 🚀 Features
26
-
27
- - Defer the database connection to when it's needed (#773)
28
- - Add customizable index names for pgvector (#818)
29
-
30
- ## [integrations/pgvector-v0.2.0] - 2024-05-08
31
-
32
- ### 🚀 Features
33
-
34
- - `MongoDBAtlasEmbeddingRetriever` (#427)
35
- - Implement keyword retrieval for pgvector integration (#644)
36
-
37
- ### 🐛 Bug Fixes
38
-
39
- - Fix order of API docs (#447)
40
-
41
- This PR will also push the docs to Readme
42
-
43
- ### 📚 Documentation
44
-
45
- - Update category slug (#442)
46
- - Disable-class-def (#556)
47
-
48
- ## [integrations/pgvector-v0.1.0] - 2024-02-14
49
-
50
- ### 🐛 Bug Fixes
51
-
52
- - Fix linting (#328)
53
-
54
-
55
-
56
- <!-- generated by git-cliff -->