pgvector-haystack 2.0.0__tar.gz → 3.0.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.
- {pgvector_haystack-2.0.0 → pgvector_haystack-3.0.0}/CHANGELOG.md +6 -0
- {pgvector_haystack-2.0.0 → pgvector_haystack-3.0.0}/PKG-INFO +3 -4
- {pgvector_haystack-2.0.0 → pgvector_haystack-3.0.0}/pyproject.toml +3 -4
- {pgvector_haystack-2.0.0 → pgvector_haystack-3.0.0}/src/haystack_integrations/document_stores/pgvector/document_store.py +6 -26
- {pgvector_haystack-2.0.0 → pgvector_haystack-3.0.0}/.gitignore +0 -0
- {pgvector_haystack-2.0.0 → pgvector_haystack-3.0.0}/LICENSE.txt +0 -0
- {pgvector_haystack-2.0.0 → pgvector_haystack-3.0.0}/README.md +0 -0
- {pgvector_haystack-2.0.0 → pgvector_haystack-3.0.0}/examples/embedding_retrieval.py +0 -0
- {pgvector_haystack-2.0.0 → pgvector_haystack-3.0.0}/examples/hybrid_retrieval.py +0 -0
- {pgvector_haystack-2.0.0 → pgvector_haystack-3.0.0}/pydoc/config.yml +0 -0
- {pgvector_haystack-2.0.0 → pgvector_haystack-3.0.0}/src/haystack_integrations/components/retrievers/pgvector/__init__.py +0 -0
- {pgvector_haystack-2.0.0 → pgvector_haystack-3.0.0}/src/haystack_integrations/components/retrievers/pgvector/embedding_retriever.py +0 -0
- {pgvector_haystack-2.0.0 → pgvector_haystack-3.0.0}/src/haystack_integrations/components/retrievers/pgvector/keyword_retriever.py +0 -0
- {pgvector_haystack-2.0.0 → pgvector_haystack-3.0.0}/src/haystack_integrations/document_stores/pgvector/__init__.py +0 -0
- {pgvector_haystack-2.0.0 → pgvector_haystack-3.0.0}/src/haystack_integrations/document_stores/pgvector/filters.py +0 -0
- {pgvector_haystack-2.0.0 → pgvector_haystack-3.0.0}/tests/__init__.py +0 -0
- {pgvector_haystack-2.0.0 → pgvector_haystack-3.0.0}/tests/conftest.py +0 -0
- {pgvector_haystack-2.0.0 → pgvector_haystack-3.0.0}/tests/test_document_store.py +0 -0
- {pgvector_haystack-2.0.0 → pgvector_haystack-3.0.0}/tests/test_embedding_retrieval.py +0 -0
- {pgvector_haystack-2.0.0 → pgvector_haystack-3.0.0}/tests/test_filters.py +0 -0
- {pgvector_haystack-2.0.0 → pgvector_haystack-3.0.0}/tests/test_keyword_retrieval.py +0 -0
- {pgvector_haystack-2.0.0 → pgvector_haystack-3.0.0}/tests/test_retrievers.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pgvector-haystack
|
|
3
|
-
Version:
|
|
3
|
+
Version: 3.0.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
|
|
@@ -11,15 +11,14 @@ License-File: LICENSE.txt
|
|
|
11
11
|
Classifier: Development Status :: 4 - Beta
|
|
12
12
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
13
13
|
Classifier: Programming Language :: Python
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
15
14
|
Classifier: Programming Language :: Python :: 3.9
|
|
16
15
|
Classifier: Programming Language :: Python :: 3.10
|
|
17
16
|
Classifier: Programming Language :: Python :: 3.11
|
|
18
17
|
Classifier: Programming Language :: Python :: 3.12
|
|
19
18
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
20
19
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
21
|
-
Requires-Python: >=3.
|
|
22
|
-
Requires-Dist: haystack-ai
|
|
20
|
+
Requires-Python: >=3.9
|
|
21
|
+
Requires-Dist: haystack-ai>=2.11.0
|
|
23
22
|
Requires-Dist: pgvector
|
|
24
23
|
Requires-Dist: psycopg[binary]
|
|
25
24
|
Description-Content-Type: text/markdown
|
|
@@ -7,7 +7,7 @@ name = "pgvector-haystack"
|
|
|
7
7
|
dynamic = ["version"]
|
|
8
8
|
description = "An integration of pgvector (vector search extension for Postgres) with Haystack"
|
|
9
9
|
readme = "README.md"
|
|
10
|
-
requires-python = ">=3.
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
11
|
license = "Apache-2.0"
|
|
12
12
|
keywords = []
|
|
13
13
|
authors = [{ name = "deepset GmbH", email = "info@deepset.ai" }]
|
|
@@ -15,7 +15,6 @@ classifiers = [
|
|
|
15
15
|
"License :: OSI Approved :: Apache Software License",
|
|
16
16
|
"Development Status :: 4 - Beta",
|
|
17
17
|
"Programming Language :: Python",
|
|
18
|
-
"Programming Language :: Python :: 3.8",
|
|
19
18
|
"Programming Language :: Python :: 3.9",
|
|
20
19
|
"Programming Language :: Python :: 3.10",
|
|
21
20
|
"Programming Language :: Python :: 3.11",
|
|
@@ -23,7 +22,7 @@ classifiers = [
|
|
|
23
22
|
"Programming Language :: Python :: Implementation :: CPython",
|
|
24
23
|
"Programming Language :: Python :: Implementation :: PyPy",
|
|
25
24
|
]
|
|
26
|
-
dependencies = ["haystack-ai", "pgvector", "psycopg[binary]"]
|
|
25
|
+
dependencies = ["haystack-ai>=2.11.0", "pgvector", "psycopg[binary]"]
|
|
27
26
|
|
|
28
27
|
[project.urls]
|
|
29
28
|
Source = "https://github.com/deepset-ai/haystack-core-integrations"
|
|
@@ -60,7 +59,7 @@ cov-retry = ["test-cov-retry", "cov-report"]
|
|
|
60
59
|
docs = ["pydoc-markdown pydoc/config.yml"]
|
|
61
60
|
|
|
62
61
|
[[tool.hatch.envs.all.matrix]]
|
|
63
|
-
python = [
|
|
62
|
+
python = [ "3.9", "3.10", "3.11", "3.12"]
|
|
64
63
|
|
|
65
64
|
[tool.hatch.envs.lint]
|
|
66
65
|
installer = "uv"
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
# SPDX-FileCopyrightText: 2023-present deepset GmbH <info@deepset.ai>
|
|
2
2
|
#
|
|
3
3
|
# SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
import logging
|
|
5
4
|
from typing import Any, Dict, List, Literal, Optional
|
|
6
5
|
|
|
7
|
-
from haystack import default_from_dict, default_to_dict
|
|
6
|
+
from haystack import default_from_dict, default_to_dict, logging
|
|
8
7
|
from haystack.dataclasses.document import ByteStream, Document
|
|
9
8
|
from haystack.document_stores.errors import DocumentStoreError, DuplicateDocumentError
|
|
10
9
|
from haystack.document_stores.types import DuplicatePolicy
|
|
@@ -193,7 +192,7 @@ class PgvectorDocumentStore:
|
|
|
193
192
|
try:
|
|
194
193
|
self._connection.close()
|
|
195
194
|
except Error as e:
|
|
196
|
-
logger.debug("Failed to close connection:
|
|
195
|
+
logger.debug("Failed to close connection: {e}", e=str(e))
|
|
197
196
|
|
|
198
197
|
conn_str = self.connection_string.resolve_value() or ""
|
|
199
198
|
connection = connect(conn_str)
|
|
@@ -295,7 +294,7 @@ class PgvectorDocumentStore:
|
|
|
295
294
|
cursor = cursor or self.cursor
|
|
296
295
|
|
|
297
296
|
sql_query_str = sql_query.as_string(cursor) if not isinstance(sql_query, str) else sql_query
|
|
298
|
-
logger.debug("SQL query:
|
|
297
|
+
logger.debug("SQL query: {query}\nParameters: {parameters}", query=sql_query_str, parameters=params)
|
|
299
298
|
|
|
300
299
|
try:
|
|
301
300
|
result = cursor.execute(sql_query, params)
|
|
@@ -512,7 +511,7 @@ class PgvectorDocumentStore:
|
|
|
512
511
|
sql_insert += SQL(" RETURNING id")
|
|
513
512
|
|
|
514
513
|
sql_query_str = sql_insert.as_string(self.cursor) if not isinstance(sql_insert, str) else sql_insert
|
|
515
|
-
logger.debug("SQL query:
|
|
514
|
+
logger.debug("SQL query: {query}\nParameters: {parameters}", query=sql_query_str, parameters=db_documents)
|
|
516
515
|
|
|
517
516
|
try:
|
|
518
517
|
self.cursor.executemany(sql_insert, db_documents, returning=True)
|
|
@@ -555,24 +554,14 @@ class PgvectorDocumentStore:
|
|
|
555
554
|
db_document["blob_mime_type"] = blob.mime_type if blob and blob.mime_type else None
|
|
556
555
|
db_document["meta"] = Jsonb(db_document["meta"])
|
|
557
556
|
|
|
558
|
-
if "dataframe" in db_document:
|
|
559
|
-
dataframe = db_document.pop("dataframe", None)
|
|
560
|
-
if dataframe:
|
|
561
|
-
logger.warning(
|
|
562
|
-
"Document %s has the `dataframe` field set. "
|
|
563
|
-
"PgvectorDocumentStore no longer supports dataframes and this field will be ignored. "
|
|
564
|
-
"The `dataframe` field will soon be removed from Haystack Document.",
|
|
565
|
-
db_document["id"],
|
|
566
|
-
)
|
|
567
|
-
|
|
568
557
|
if "sparse_embedding" in db_document:
|
|
569
558
|
sparse_embedding = db_document.pop("sparse_embedding", None)
|
|
570
559
|
if sparse_embedding:
|
|
571
560
|
logger.warning(
|
|
572
|
-
"Document
|
|
561
|
+
"Document {doc_id} has the `sparse_embedding` field set,"
|
|
573
562
|
"but storing sparse embeddings in Pgvector is not currently supported."
|
|
574
563
|
"The `sparse_embedding` field will be ignored.",
|
|
575
|
-
db_document["id"],
|
|
564
|
+
doc_id=db_document["id"],
|
|
576
565
|
)
|
|
577
566
|
|
|
578
567
|
db_documents.append(db_document)
|
|
@@ -591,20 +580,11 @@ class PgvectorDocumentStore:
|
|
|
591
580
|
blob_data = haystack_dict.pop("blob_data")
|
|
592
581
|
blob_meta = haystack_dict.pop("blob_meta")
|
|
593
582
|
blob_mime_type = haystack_dict.pop("blob_mime_type")
|
|
594
|
-
dataframe = haystack_dict.pop("dataframe", None)
|
|
595
583
|
|
|
596
584
|
# convert the embedding to a list of floats
|
|
597
585
|
if document.get("embedding") is not None:
|
|
598
586
|
haystack_dict["embedding"] = document["embedding"].tolist()
|
|
599
587
|
|
|
600
|
-
if dataframe:
|
|
601
|
-
logger.warning(
|
|
602
|
-
"Document %s has the `dataframe` field set. "
|
|
603
|
-
"PgvectorDocumentStore no longer supports dataframes and this field will be ignored. "
|
|
604
|
-
"The `dataframe` field will soon be removed from Haystack Document.",
|
|
605
|
-
haystack_dict["id"],
|
|
606
|
-
)
|
|
607
|
-
|
|
608
588
|
haystack_document = Document.from_dict(haystack_dict)
|
|
609
589
|
|
|
610
590
|
if blob_data:
|
|
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
|