pgvector-haystack 3.0.0__tar.gz → 3.0.1__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.
- {pgvector_haystack-3.0.0 → pgvector_haystack-3.0.1}/CHANGELOG.md +135 -127
- {pgvector_haystack-3.0.0 → pgvector_haystack-3.0.1}/PKG-INFO +1 -1
- {pgvector_haystack-3.0.0 → pgvector_haystack-3.0.1}/src/haystack_integrations/document_stores/pgvector/document_store.py +15 -6
- {pgvector_haystack-3.0.0 → pgvector_haystack-3.0.1}/tests/test_document_store.py +47 -0
- {pgvector_haystack-3.0.0 → pgvector_haystack-3.0.1}/.gitignore +0 -0
- {pgvector_haystack-3.0.0 → pgvector_haystack-3.0.1}/LICENSE.txt +0 -0
- {pgvector_haystack-3.0.0 → pgvector_haystack-3.0.1}/README.md +0 -0
- {pgvector_haystack-3.0.0 → pgvector_haystack-3.0.1}/examples/embedding_retrieval.py +0 -0
- {pgvector_haystack-3.0.0 → pgvector_haystack-3.0.1}/examples/hybrid_retrieval.py +0 -0
- {pgvector_haystack-3.0.0 → pgvector_haystack-3.0.1}/pydoc/config.yml +0 -0
- {pgvector_haystack-3.0.0 → pgvector_haystack-3.0.1}/pyproject.toml +0 -0
- {pgvector_haystack-3.0.0 → pgvector_haystack-3.0.1}/src/haystack_integrations/components/retrievers/pgvector/__init__.py +0 -0
- {pgvector_haystack-3.0.0 → pgvector_haystack-3.0.1}/src/haystack_integrations/components/retrievers/pgvector/embedding_retriever.py +0 -0
- {pgvector_haystack-3.0.0 → pgvector_haystack-3.0.1}/src/haystack_integrations/components/retrievers/pgvector/keyword_retriever.py +0 -0
- {pgvector_haystack-3.0.0 → pgvector_haystack-3.0.1}/src/haystack_integrations/document_stores/pgvector/__init__.py +0 -0
- {pgvector_haystack-3.0.0 → pgvector_haystack-3.0.1}/src/haystack_integrations/document_stores/pgvector/filters.py +0 -0
- {pgvector_haystack-3.0.0 → pgvector_haystack-3.0.1}/tests/__init__.py +0 -0
- {pgvector_haystack-3.0.0 → pgvector_haystack-3.0.1}/tests/conftest.py +0 -0
- {pgvector_haystack-3.0.0 → pgvector_haystack-3.0.1}/tests/test_embedding_retrieval.py +0 -0
- {pgvector_haystack-3.0.0 → pgvector_haystack-3.0.1}/tests/test_filters.py +0 -0
- {pgvector_haystack-3.0.0 → pgvector_haystack-3.0.1}/tests/test_keyword_retrieval.py +0 -0
- {pgvector_haystack-3.0.0 → pgvector_haystack-3.0.1}/tests/test_retrievers.py +0 -0
|
@@ -1,127 +1,135 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
## [integrations/pgvector-
|
|
4
|
-
|
|
5
|
-
### 🧹 Chores
|
|
6
|
-
|
|
7
|
-
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
- Add
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
-
|
|
49
|
-
|
|
50
|
-
###
|
|
51
|
-
|
|
52
|
-
-
|
|
53
|
-
|
|
54
|
-
###
|
|
55
|
-
|
|
56
|
-
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
-
|
|
70
|
-
-
|
|
71
|
-
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
-
|
|
78
|
-
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
-
|
|
107
|
-
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
- Pgvector:
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [integrations/pgvector-v3.0.0] - 2025-03-11
|
|
4
|
+
|
|
5
|
+
### 🧹 Chores
|
|
6
|
+
|
|
7
|
+
- Remove Python 3.8 support (#1421)
|
|
8
|
+
- Use Haystack logging across integrations (#1484)
|
|
9
|
+
- Pgvector - pin haystack and remove dataframe checks (#1518)
|
|
10
|
+
|
|
11
|
+
## [integrations/pgvector-v2.0.0] - 2025-02-13
|
|
12
|
+
|
|
13
|
+
### 🧹 Chores
|
|
14
|
+
|
|
15
|
+
- Pgvector - remove support for dataframe (#1370)
|
|
16
|
+
|
|
17
|
+
## [integrations/pgvector-v1.3.0] - 2025-02-03
|
|
18
|
+
|
|
19
|
+
### 🚀 Features
|
|
20
|
+
|
|
21
|
+
- Pgvector - add like and not like filters (#1341)
|
|
22
|
+
|
|
23
|
+
### 🧹 Chores
|
|
24
|
+
|
|
25
|
+
- Inherit from `FilterDocumentsTestWithDataframe` in Document Stores (#1290)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
## [integrations/pgvector-v1.2.1] - 2025-01-10
|
|
29
|
+
|
|
30
|
+
### 🐛 Bug Fixes
|
|
31
|
+
|
|
32
|
+
- PgvectorDocumentStore - use appropriate schema name if dropping index (#1277)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
## [integrations/pgvector-v1.2.0] - 2024-11-22
|
|
36
|
+
|
|
37
|
+
### 🚀 Features
|
|
38
|
+
|
|
39
|
+
- Add `create_extension` parameter to control vector extension creation (#1213)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
## [integrations/pgvector-v1.1.0] - 2024-11-21
|
|
43
|
+
|
|
44
|
+
### 🚀 Features
|
|
45
|
+
|
|
46
|
+
- Add filter_policy to pgvector integration (#820)
|
|
47
|
+
- Add schema support to pgvector document store. (#1095)
|
|
48
|
+
- Pgvector - recreate the connection if it is no longer valid (#1202)
|
|
49
|
+
|
|
50
|
+
### 🐛 Bug Fixes
|
|
51
|
+
|
|
52
|
+
- `PgVector` - Fallback to default filter policy when deserializing retrievers without the init parameter (#900)
|
|
53
|
+
|
|
54
|
+
### 📚 Documentation
|
|
55
|
+
|
|
56
|
+
- Explain different connection string formats in the docstring (#1132)
|
|
57
|
+
|
|
58
|
+
### 🧪 Testing
|
|
59
|
+
|
|
60
|
+
- Do not retry tests in `hatch run test` command (#954)
|
|
61
|
+
|
|
62
|
+
### ⚙️ CI
|
|
63
|
+
|
|
64
|
+
- Retry tests to reduce flakyness (#836)
|
|
65
|
+
- Adopt uv as installer (#1142)
|
|
66
|
+
|
|
67
|
+
### 🧹 Chores
|
|
68
|
+
|
|
69
|
+
- Update ruff invocation to include check parameter (#853)
|
|
70
|
+
- PgVector - remove legacy filter support (#1068)
|
|
71
|
+
- Update changelog after removing legacy filters (#1083)
|
|
72
|
+
- Update ruff linting scripts and settings (#1105)
|
|
73
|
+
|
|
74
|
+
### 🌀 Miscellaneous
|
|
75
|
+
|
|
76
|
+
- Ci: install `pytest-rerunfailures` where needed; add retry config to `test-cov` script (#845)
|
|
77
|
+
- Chore: Minor retriever pydoc fix (#884)
|
|
78
|
+
- Chore: Update pgvector test for the new `apply_filter_policy` usage (#970)
|
|
79
|
+
- Chore: pgvector ruff update, don't ruff tests (#984)
|
|
80
|
+
|
|
81
|
+
## [integrations/pgvector-v0.4.0] - 2024-06-20
|
|
82
|
+
|
|
83
|
+
### 🚀 Features
|
|
84
|
+
|
|
85
|
+
- Defer the database connection to when it's needed (#773)
|
|
86
|
+
- Add customizable index names for pgvector (#818)
|
|
87
|
+
|
|
88
|
+
### 🌀 Miscellaneous
|
|
89
|
+
|
|
90
|
+
- Docs: add missing api references (#728)
|
|
91
|
+
- [deepset-ai/haystack-core-integrations#727] (#738)
|
|
92
|
+
|
|
93
|
+
## [integrations/pgvector-v0.2.0] - 2024-05-08
|
|
94
|
+
|
|
95
|
+
### 🚀 Features
|
|
96
|
+
|
|
97
|
+
- `MongoDBAtlasEmbeddingRetriever` (#427)
|
|
98
|
+
- Implement keyword retrieval for pgvector integration (#644)
|
|
99
|
+
|
|
100
|
+
### 🐛 Bug Fixes
|
|
101
|
+
|
|
102
|
+
- Fix order of API docs (#447)
|
|
103
|
+
|
|
104
|
+
### 📚 Documentation
|
|
105
|
+
|
|
106
|
+
- Update category slug (#442)
|
|
107
|
+
- Disable-class-def (#556)
|
|
108
|
+
|
|
109
|
+
### 🌀 Miscellaneous
|
|
110
|
+
|
|
111
|
+
- Pgvector - review docstrings and API reference (#502)
|
|
112
|
+
- Refactor tests (#574)
|
|
113
|
+
- Remove references to Python 3.7 (#601)
|
|
114
|
+
- Make Document Stores initially skip `SparseEmbedding` (#606)
|
|
115
|
+
- Chore: add license classifiers (#680)
|
|
116
|
+
- Type hints in pgvector document store updated for 3.8 compability (#704)
|
|
117
|
+
- Chore: change the pydoc renderer class (#718)
|
|
118
|
+
|
|
119
|
+
## [integrations/pgvector-v0.1.0] - 2024-02-14
|
|
120
|
+
|
|
121
|
+
### 🐛 Bug Fixes
|
|
122
|
+
|
|
123
|
+
- Pgvector: fix linting (#328)
|
|
124
|
+
|
|
125
|
+
### 🌀 Miscellaneous
|
|
126
|
+
|
|
127
|
+
- Pgvector Document Store - minimal implementation (#239)
|
|
128
|
+
- Pgvector - filters (#257)
|
|
129
|
+
- Pgvector - embedding retrieval (#298)
|
|
130
|
+
- Pgvector - Embedding Retriever (#320)
|
|
131
|
+
- Pgvector: generate API docs (#325)
|
|
132
|
+
- Pgvector: add an example (#334)
|
|
133
|
+
- Adopt `Secret` to pgvector (#402)
|
|
134
|
+
|
|
135
|
+
<!-- generated by git-cliff -->
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pgvector-haystack
|
|
3
|
-
Version: 3.0.
|
|
3
|
+
Version: 3.0.1
|
|
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
|
|
@@ -23,7 +23,7 @@ from .filters import _convert_filters_to_where_clause_and_params
|
|
|
23
23
|
logger = logging.getLogger(__name__)
|
|
24
24
|
|
|
25
25
|
CREATE_TABLE_STATEMENT = """
|
|
26
|
-
CREATE TABLE
|
|
26
|
+
CREATE TABLE {schema_name}.{table_name} (
|
|
27
27
|
id VARCHAR(128) PRIMARY KEY,
|
|
28
28
|
embedding VECTOR({embedding_dimension}),
|
|
29
29
|
content TEXT,
|
|
@@ -310,13 +310,22 @@ class PgvectorDocumentStore:
|
|
|
310
310
|
Creates the table to store Haystack documents if it doesn't exist yet.
|
|
311
311
|
"""
|
|
312
312
|
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
313
|
+
table_exists = bool(
|
|
314
|
+
self._execute_sql(
|
|
315
|
+
"SELECT 1 FROM pg_tables WHERE schemaname = %s AND tablename = %s",
|
|
316
|
+
(self.schema_name, self.table_name),
|
|
317
|
+
"Could not check if table exists",
|
|
318
|
+
).fetchone()
|
|
317
319
|
)
|
|
318
320
|
|
|
319
|
-
|
|
321
|
+
if not table_exists:
|
|
322
|
+
create_sql = SQL(CREATE_TABLE_STATEMENT).format(
|
|
323
|
+
schema_name=Identifier(self.schema_name),
|
|
324
|
+
table_name=Identifier(self.table_name),
|
|
325
|
+
embedding_dimension=SQLLiteral(self.embedding_dimension),
|
|
326
|
+
)
|
|
327
|
+
|
|
328
|
+
self._execute_sql(create_sql, error_msg="Could not create table in PgvectorDocumentStore")
|
|
320
329
|
|
|
321
330
|
def delete_table(self):
|
|
322
331
|
"""
|
|
@@ -288,3 +288,50 @@ def test_hnsw_index_recreation():
|
|
|
288
288
|
|
|
289
289
|
# verify that oids differ
|
|
290
290
|
assert second_oid != first_oid, "Index was not recreated (OID remained the same)"
|
|
291
|
+
|
|
292
|
+
# Clean up: drop the schema after the test
|
|
293
|
+
with psycopg.connect(connection_string, autocommit=True) as conn:
|
|
294
|
+
conn.execute(f"DROP SCHEMA IF EXISTS {schema_name} CASCADE")
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
@pytest.mark.integration
|
|
298
|
+
def test_create_table_if_not_exists():
|
|
299
|
+
def get_table_oid(document_store, schema_name, table_name):
|
|
300
|
+
sql_get_table_oid = """
|
|
301
|
+
SELECT c.oid
|
|
302
|
+
FROM pg_class c
|
|
303
|
+
JOIN pg_namespace n ON n.oid = c.relnamespace
|
|
304
|
+
WHERE c.relkind = 'r'
|
|
305
|
+
AND n.nspname = %s
|
|
306
|
+
AND c.relname = %s;
|
|
307
|
+
"""
|
|
308
|
+
return document_store.cursor.execute(sql_get_table_oid, (schema_name, table_name)).fetchone()[0]
|
|
309
|
+
|
|
310
|
+
connection_string = "postgresql://postgres:postgres@localhost:5432/postgres"
|
|
311
|
+
schema_name = "test_schema"
|
|
312
|
+
table_name = "test_table"
|
|
313
|
+
|
|
314
|
+
# Create a new schema
|
|
315
|
+
with psycopg.connect(connection_string, autocommit=True) as conn:
|
|
316
|
+
conn.execute(f"CREATE SCHEMA {schema_name}")
|
|
317
|
+
|
|
318
|
+
document_store = PgvectorDocumentStore(
|
|
319
|
+
connection_string=Secret.from_token(connection_string),
|
|
320
|
+
schema_name=schema_name,
|
|
321
|
+
table_name=table_name,
|
|
322
|
+
)
|
|
323
|
+
|
|
324
|
+
document_store._create_table_if_not_exists()
|
|
325
|
+
|
|
326
|
+
first_table_oid = get_table_oid(document_store, schema_name, table_name)
|
|
327
|
+
assert first_table_oid is not None, "Table was not created"
|
|
328
|
+
|
|
329
|
+
document_store._create_table_if_not_exists()
|
|
330
|
+
|
|
331
|
+
second_table_oid = get_table_oid(document_store, schema_name, table_name)
|
|
332
|
+
|
|
333
|
+
assert first_table_oid == second_table_oid, "Table was recreated"
|
|
334
|
+
|
|
335
|
+
# Clean up: drop the schema after the test
|
|
336
|
+
with psycopg.connect(connection_string, autocommit=True) as conn:
|
|
337
|
+
conn.execute(f"DROP SCHEMA IF EXISTS {schema_name} CASCADE")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|