pgvector-haystack 0.5.0__tar.gz → 0.5.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-0.5.0 → pgvector_haystack-0.5.1}/PKG-INFO +1 -1
- {pgvector_haystack-0.5.0 → pgvector_haystack-0.5.1}/src/haystack_integrations/components/retrievers/pgvector/embedding_retriever.py +4 -1
- {pgvector_haystack-0.5.0 → pgvector_haystack-0.5.1}/src/haystack_integrations/components/retrievers/pgvector/keyword_retriever.py +4 -1
- {pgvector_haystack-0.5.0 → pgvector_haystack-0.5.1}/tests/test_retrievers.py +48 -0
- {pgvector_haystack-0.5.0 → pgvector_haystack-0.5.1}/.gitignore +0 -0
- {pgvector_haystack-0.5.0 → pgvector_haystack-0.5.1}/CHANGELOG.md +0 -0
- {pgvector_haystack-0.5.0 → pgvector_haystack-0.5.1}/LICENSE.txt +0 -0
- {pgvector_haystack-0.5.0 → pgvector_haystack-0.5.1}/README.md +0 -0
- {pgvector_haystack-0.5.0 → pgvector_haystack-0.5.1}/examples/embedding_retrieval.py +0 -0
- {pgvector_haystack-0.5.0 → pgvector_haystack-0.5.1}/examples/hybrid_retrieval.py +0 -0
- {pgvector_haystack-0.5.0 → pgvector_haystack-0.5.1}/pydoc/config.yml +0 -0
- {pgvector_haystack-0.5.0 → pgvector_haystack-0.5.1}/pyproject.toml +0 -0
- {pgvector_haystack-0.5.0 → pgvector_haystack-0.5.1}/src/haystack_integrations/components/retrievers/pgvector/__init__.py +0 -0
- {pgvector_haystack-0.5.0 → pgvector_haystack-0.5.1}/src/haystack_integrations/document_stores/pgvector/__init__.py +0 -0
- {pgvector_haystack-0.5.0 → pgvector_haystack-0.5.1}/src/haystack_integrations/document_stores/pgvector/document_store.py +0 -0
- {pgvector_haystack-0.5.0 → pgvector_haystack-0.5.1}/src/haystack_integrations/document_stores/pgvector/filters.py +0 -0
- {pgvector_haystack-0.5.0 → pgvector_haystack-0.5.1}/tests/__init__.py +0 -0
- {pgvector_haystack-0.5.0 → pgvector_haystack-0.5.1}/tests/conftest.py +0 -0
- {pgvector_haystack-0.5.0 → pgvector_haystack-0.5.1}/tests/test_document_store.py +0 -0
- {pgvector_haystack-0.5.0 → pgvector_haystack-0.5.1}/tests/test_embedding_retrieval.py +0 -0
- {pgvector_haystack-0.5.0 → pgvector_haystack-0.5.1}/tests/test_filters.py +0 -0
- {pgvector_haystack-0.5.0 → pgvector_haystack-0.5.1}/tests/test_keyword_retrieval.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: pgvector-haystack
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.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
|
|
@@ -126,7 +126,10 @@ class PgvectorEmbeddingRetriever:
|
|
|
126
126
|
"""
|
|
127
127
|
doc_store_params = data["init_parameters"]["document_store"]
|
|
128
128
|
data["init_parameters"]["document_store"] = PgvectorDocumentStore.from_dict(doc_store_params)
|
|
129
|
-
|
|
129
|
+
# Pipelines serialized with old versions of the component might not
|
|
130
|
+
# have the filter_policy field.
|
|
131
|
+
if filter_policy := data["init_parameters"].get("filter_policy"):
|
|
132
|
+
data["init_parameters"]["filter_policy"] = FilterPolicy.from_str(filter_policy)
|
|
130
133
|
return default_from_dict(cls, data)
|
|
131
134
|
|
|
132
135
|
@component.output_types(documents=List[Document])
|
|
@@ -100,7 +100,10 @@ class PgvectorKeywordRetriever:
|
|
|
100
100
|
"""
|
|
101
101
|
doc_store_params = data["init_parameters"]["document_store"]
|
|
102
102
|
data["init_parameters"]["document_store"] = PgvectorDocumentStore.from_dict(doc_store_params)
|
|
103
|
-
|
|
103
|
+
# Pipelines serialized with old versions of the component might not
|
|
104
|
+
# have the filter_policy field.
|
|
105
|
+
if filter_policy := data["init_parameters"].get("filter_policy"):
|
|
106
|
+
data["init_parameters"]["filter_policy"] = FilterPolicy.from_str(filter_policy)
|
|
104
107
|
return default_from_dict(cls, data)
|
|
105
108
|
|
|
106
109
|
@component.output_types(documents=List[Document])
|
|
@@ -241,6 +241,54 @@ class TestKeywordRetriever:
|
|
|
241
241
|
assert retriever.filters == {"field": "value"}
|
|
242
242
|
assert retriever.top_k == 5
|
|
243
243
|
|
|
244
|
+
@pytest.mark.usefixtures("patches_for_unit_tests")
|
|
245
|
+
def test_from_dict_without_filter_policy(self, monkeypatch):
|
|
246
|
+
monkeypatch.setenv("PG_CONN_STR", "some-connection-string")
|
|
247
|
+
t = "haystack_integrations.components.retrievers.pgvector.keyword_retriever.PgvectorKeywordRetriever"
|
|
248
|
+
data = {
|
|
249
|
+
"type": t,
|
|
250
|
+
"init_parameters": {
|
|
251
|
+
"document_store": {
|
|
252
|
+
"type": "haystack_integrations.document_stores.pgvector.document_store.PgvectorDocumentStore",
|
|
253
|
+
"init_parameters": {
|
|
254
|
+
"connection_string": {"env_vars": ["PG_CONN_STR"], "strict": True, "type": "env_var"},
|
|
255
|
+
"table_name": "haystack_test_to_dict",
|
|
256
|
+
"embedding_dimension": 768,
|
|
257
|
+
"vector_function": "cosine_similarity",
|
|
258
|
+
"recreate_table": True,
|
|
259
|
+
"search_strategy": "exact_nearest_neighbor",
|
|
260
|
+
"hnsw_recreate_index_if_exists": False,
|
|
261
|
+
"hnsw_index_creation_kwargs": {},
|
|
262
|
+
"hnsw_index_name": "haystack_hnsw_index",
|
|
263
|
+
"hnsw_ef_search": None,
|
|
264
|
+
"keyword_index_name": "haystack_keyword_index",
|
|
265
|
+
},
|
|
266
|
+
},
|
|
267
|
+
"filters": {"field": "value"},
|
|
268
|
+
"top_k": 5,
|
|
269
|
+
},
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
retriever = PgvectorKeywordRetriever.from_dict(data)
|
|
273
|
+
document_store = retriever.document_store
|
|
274
|
+
|
|
275
|
+
assert isinstance(document_store, PgvectorDocumentStore)
|
|
276
|
+
assert isinstance(document_store.connection_string, EnvVarSecret)
|
|
277
|
+
assert document_store.table_name == "haystack_test_to_dict"
|
|
278
|
+
assert document_store.embedding_dimension == 768
|
|
279
|
+
assert document_store.vector_function == "cosine_similarity"
|
|
280
|
+
assert document_store.recreate_table
|
|
281
|
+
assert document_store.search_strategy == "exact_nearest_neighbor"
|
|
282
|
+
assert not document_store.hnsw_recreate_index_if_exists
|
|
283
|
+
assert document_store.hnsw_index_creation_kwargs == {}
|
|
284
|
+
assert document_store.hnsw_index_name == "haystack_hnsw_index"
|
|
285
|
+
assert document_store.hnsw_ef_search is None
|
|
286
|
+
assert document_store.keyword_index_name == "haystack_keyword_index"
|
|
287
|
+
|
|
288
|
+
assert retriever.filters == {"field": "value"}
|
|
289
|
+
assert retriever.filter_policy == FilterPolicy.REPLACE # defaults to REPLACE
|
|
290
|
+
assert retriever.top_k == 5
|
|
291
|
+
|
|
244
292
|
def test_run(self):
|
|
245
293
|
mock_store = Mock(spec=PgvectorDocumentStore)
|
|
246
294
|
doc = Document(content="Test doc", embedding=[0.1, 0.2])
|
|
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
|