pgvector-haystack 2.0.0__py3-none-any.whl → 3.0.0__py3-none-any.whl

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.
@@ -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: %s", str(e))
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: %s\nParameters: %s", sql_query_str, params)
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: %s\nParameters: %s", sql_query_str, db_documents)
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 %s has the `sparse_embedding` field set,"
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:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pgvector-haystack
3
- Version: 2.0.0
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.8
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
@@ -2,9 +2,9 @@ haystack_integrations/components/retrievers/pgvector/__init__.py,sha256=n4q4pUAp
2
2
  haystack_integrations/components/retrievers/pgvector/embedding_retriever.py,sha256=IEIdgKy_IWgmL5Qy_Hqkwa2mq2JxnQ_JOdjm38JPxmE,7530
3
3
  haystack_integrations/components/retrievers/pgvector/keyword_retriever.py,sha256=SYHqjTkDczobYZ2qq0z8yS9p_g8aINnzwA5AN_nKdHI,5632
4
4
  haystack_integrations/document_stores/pgvector/__init__.py,sha256=Ge-7ggarfr3x8UqNdFHUuFGiu52u49sOVe3l16WEwZU,197
5
- haystack_integrations/document_stores/pgvector/document_store.py,sha256=rirjSAMaPLADimwPcj-WQohrQbnXpTWgOCSIJy3qpPg,32148
5
+ haystack_integrations/document_stores/pgvector/document_store.py,sha256=bs1MCwiQgoTw8Wrad8DaRRgIQokk8_t1fLmzxdufWS4,31267
6
6
  haystack_integrations/document_stores/pgvector/filters.py,sha256=M-_wmM1iKS1QdKhnRk27N8t2W1st2YZWAwVSFUyyTtk,8508
7
- pgvector_haystack-2.0.0.dist-info/METADATA,sha256=NhUGkaP8KzfX8qrlU5LrI-pjEQ3B4UDCfqN-WvlXsGY,2226
8
- pgvector_haystack-2.0.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
9
- pgvector_haystack-2.0.0.dist-info/licenses/LICENSE.txt,sha256=B05uMshqTA74s-0ltyHKI6yoPfJ3zYgQbvcXfDVGFf8,10280
10
- pgvector_haystack-2.0.0.dist-info/RECORD,,
7
+ pgvector_haystack-3.0.0.dist-info/METADATA,sha256=1rd0uO91j_NxG5hmxXIhn7RFPYJsDgO9w7XBqKMMw-Q,2184
8
+ pgvector_haystack-3.0.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
9
+ pgvector_haystack-3.0.0.dist-info/licenses/LICENSE.txt,sha256=B05uMshqTA74s-0ltyHKI6yoPfJ3zYgQbvcXfDVGFf8,10280
10
+ pgvector_haystack-3.0.0.dist-info/RECORD,,