qdrant-haystack 4.1.2__py3-none-any.whl → 4.2.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.
Potentially problematic release.
This version of qdrant-haystack might be problematic. Click here for more details.
- haystack_integrations/components/retrievers/qdrant/retriever.py +2 -1
- haystack_integrations/document_stores/qdrant/document_store.py +33 -50
- haystack_integrations/document_stores/qdrant/migrate_to_sparse.py +2 -1
- {qdrant_haystack-4.1.2.dist-info → qdrant_haystack-4.2.0.dist-info}/METADATA +1 -1
- {qdrant_haystack-4.1.2.dist-info → qdrant_haystack-4.2.0.dist-info}/RECORD +7 -7
- {qdrant_haystack-4.1.2.dist-info → qdrant_haystack-4.2.0.dist-info}/WHEEL +0 -0
- {qdrant_haystack-4.1.2.dist-info → qdrant_haystack-4.2.0.dist-info}/licenses/LICENSE.txt +0 -0
|
@@ -4,9 +4,10 @@ from haystack import Document, component, default_from_dict, default_to_dict
|
|
|
4
4
|
from haystack.dataclasses.sparse_embedding import SparseEmbedding
|
|
5
5
|
from haystack.document_stores.types import FilterPolicy
|
|
6
6
|
from haystack.document_stores.types.filter_policy import apply_filter_policy
|
|
7
|
-
from haystack_integrations.document_stores.qdrant import QdrantDocumentStore
|
|
8
7
|
from qdrant_client.http import models
|
|
9
8
|
|
|
9
|
+
from haystack_integrations.document_stores.qdrant import QdrantDocumentStore
|
|
10
|
+
|
|
10
11
|
|
|
11
12
|
@component
|
|
12
13
|
class QdrantEmbeddingRetriever:
|
|
@@ -15,7 +15,6 @@ from haystack.utils.filters import convert as convert_legacy_filters
|
|
|
15
15
|
from qdrant_client import grpc
|
|
16
16
|
from qdrant_client.http import models as rest
|
|
17
17
|
from qdrant_client.http.exceptions import UnexpectedResponse
|
|
18
|
-
from qdrant_client.hybrid.fusion import reciprocal_rank_fusion
|
|
19
18
|
from tqdm import tqdm
|
|
20
19
|
|
|
21
20
|
from .converters import (
|
|
@@ -537,20 +536,18 @@ class QdrantDocumentStore:
|
|
|
537
536
|
qdrant_filters = convert_filters_to_qdrant(filters)
|
|
538
537
|
query_indices = query_sparse_embedding.indices
|
|
539
538
|
query_values = query_sparse_embedding.values
|
|
540
|
-
points = self.client.
|
|
539
|
+
points = self.client.query_points(
|
|
541
540
|
collection_name=self.index,
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
indices=query_indices,
|
|
546
|
-
values=query_values,
|
|
547
|
-
),
|
|
541
|
+
query=rest.SparseVector(
|
|
542
|
+
indices=query_indices,
|
|
543
|
+
values=query_values,
|
|
548
544
|
),
|
|
545
|
+
using=SPARSE_VECTORS_NAME,
|
|
549
546
|
query_filter=qdrant_filters,
|
|
550
547
|
limit=top_k,
|
|
551
548
|
with_vectors=return_embedding,
|
|
552
549
|
score_threshold=score_threshold,
|
|
553
|
-
)
|
|
550
|
+
).points
|
|
554
551
|
results = [
|
|
555
552
|
convert_qdrant_point_to_haystack_document(point, use_sparse_embeddings=self.use_sparse_embeddings)
|
|
556
553
|
for point in points
|
|
@@ -588,17 +585,15 @@ class QdrantDocumentStore:
|
|
|
588
585
|
"""
|
|
589
586
|
qdrant_filters = convert_filters_to_qdrant(filters)
|
|
590
587
|
|
|
591
|
-
points = self.client.
|
|
588
|
+
points = self.client.query_points(
|
|
592
589
|
collection_name=self.index,
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
vector=query_embedding,
|
|
596
|
-
),
|
|
590
|
+
query=query_embedding,
|
|
591
|
+
using=DENSE_VECTORS_NAME if self.use_sparse_embeddings else None,
|
|
597
592
|
query_filter=qdrant_filters,
|
|
598
593
|
limit=top_k,
|
|
599
594
|
with_vectors=return_embedding,
|
|
600
595
|
score_threshold=score_threshold,
|
|
601
|
-
)
|
|
596
|
+
).points
|
|
602
597
|
results = [
|
|
603
598
|
convert_qdrant_point_to_haystack_document(point, use_sparse_embeddings=self.use_sparse_embeddings)
|
|
604
599
|
for point in points
|
|
@@ -655,46 +650,34 @@ class QdrantDocumentStore:
|
|
|
655
650
|
|
|
656
651
|
qdrant_filters = convert_filters_to_qdrant(filters)
|
|
657
652
|
|
|
658
|
-
sparse_request = rest.SearchRequest(
|
|
659
|
-
vector=rest.NamedSparseVector(
|
|
660
|
-
name=SPARSE_VECTORS_NAME,
|
|
661
|
-
vector=rest.SparseVector(
|
|
662
|
-
indices=query_sparse_embedding.indices,
|
|
663
|
-
values=query_sparse_embedding.values,
|
|
664
|
-
),
|
|
665
|
-
),
|
|
666
|
-
filter=qdrant_filters,
|
|
667
|
-
limit=top_k,
|
|
668
|
-
with_payload=True,
|
|
669
|
-
with_vector=return_embedding,
|
|
670
|
-
score_threshold=score_threshold,
|
|
671
|
-
)
|
|
672
|
-
|
|
673
|
-
dense_request = rest.SearchRequest(
|
|
674
|
-
vector=rest.NamedVector(
|
|
675
|
-
name=DENSE_VECTORS_NAME,
|
|
676
|
-
vector=query_embedding,
|
|
677
|
-
),
|
|
678
|
-
filter=qdrant_filters,
|
|
679
|
-
limit=top_k,
|
|
680
|
-
with_payload=True,
|
|
681
|
-
with_vector=return_embedding,
|
|
682
|
-
)
|
|
683
|
-
|
|
684
653
|
try:
|
|
685
|
-
|
|
686
|
-
collection_name=self.index,
|
|
687
|
-
|
|
654
|
+
points = self.client.query_points(
|
|
655
|
+
collection_name=self.index,
|
|
656
|
+
prefetch=[
|
|
657
|
+
rest.Prefetch(
|
|
658
|
+
query=rest.SparseVector(
|
|
659
|
+
indices=query_sparse_embedding.indices,
|
|
660
|
+
values=query_sparse_embedding.values,
|
|
661
|
+
),
|
|
662
|
+
using=SPARSE_VECTORS_NAME,
|
|
663
|
+
filter=qdrant_filters,
|
|
664
|
+
),
|
|
665
|
+
rest.Prefetch(
|
|
666
|
+
query=query_embedding,
|
|
667
|
+
using=DENSE_VECTORS_NAME,
|
|
668
|
+
filter=qdrant_filters,
|
|
669
|
+
),
|
|
670
|
+
],
|
|
671
|
+
query=rest.FusionQuery(fusion=rest.Fusion.RRF),
|
|
672
|
+
limit=top_k,
|
|
673
|
+
score_threshold=score_threshold,
|
|
674
|
+
with_payload=True,
|
|
675
|
+
with_vectors=return_embedding,
|
|
676
|
+
).points
|
|
688
677
|
except Exception as e:
|
|
689
678
|
msg = "Error during hybrid search"
|
|
690
679
|
raise QdrantStoreError(msg) from e
|
|
691
680
|
|
|
692
|
-
try:
|
|
693
|
-
points = reciprocal_rank_fusion(responses=[dense_request_response, sparse_request_response], limit=top_k)
|
|
694
|
-
except Exception as e:
|
|
695
|
-
msg = "Error while applying Reciprocal Rank Fusion"
|
|
696
|
-
raise QdrantStoreError(msg) from e
|
|
697
|
-
|
|
698
681
|
results = [convert_qdrant_point_to_haystack_document(point, use_sparse_embeddings=True) for point in points]
|
|
699
682
|
|
|
700
683
|
return results
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
import time
|
|
3
3
|
|
|
4
|
-
from haystack_integrations.document_stores.qdrant import QdrantDocumentStore
|
|
5
4
|
from qdrant_client.http import models
|
|
6
5
|
|
|
6
|
+
from haystack_integrations.document_stores.qdrant import QdrantDocumentStore
|
|
7
|
+
|
|
7
8
|
logger = logging.getLogger(__name__)
|
|
8
9
|
logger.addHandler(logging.StreamHandler())
|
|
9
10
|
logger.setLevel(logging.INFO)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: qdrant-haystack
|
|
3
|
-
Version: 4.
|
|
3
|
+
Version: 4.2.0
|
|
4
4
|
Summary: An integration of Qdrant ANN vector database backend 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/qdrant/README.md
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
haystack_integrations/components/retrievers/qdrant/__init__.py,sha256=IRjcM4f8b5eKFEMn8tn6h6RrfslEGP3WafU7mrzNzQM,313
|
|
2
|
-
haystack_integrations/components/retrievers/qdrant/retriever.py,sha256=
|
|
2
|
+
haystack_integrations/components/retrievers/qdrant/retriever.py,sha256=DIqwa2JMVP7z52wmKdCfFk1ZdV0j50ZYCuRluQu5llk,18449
|
|
3
3
|
haystack_integrations/document_stores/qdrant/__init__.py,sha256=kUGc5uewqArhmVR-JqB_NmJ4kNkTIQIvYDNSoO2ELn0,302
|
|
4
4
|
haystack_integrations/document_stores/qdrant/converters.py,sha256=2hcuI3kty1dVHzX1WGXxEtlrnZ9E8TAG56XATCFa6Pw,2491
|
|
5
|
-
haystack_integrations/document_stores/qdrant/document_store.py,sha256=
|
|
5
|
+
haystack_integrations/document_stores/qdrant/document_store.py,sha256=zkRlg-vppenzy1QEFKQh9vyCEBehdYP42_cn0-Uu5vE,37587
|
|
6
6
|
haystack_integrations/document_stores/qdrant/filters.py,sha256=Nv_eKIYKwUWvldJfa0omfFQ0kgqi6L3DUFeMuIWziOY,11751
|
|
7
|
-
haystack_integrations/document_stores/qdrant/migrate_to_sparse.py,sha256=
|
|
8
|
-
qdrant_haystack-4.
|
|
9
|
-
qdrant_haystack-4.
|
|
10
|
-
qdrant_haystack-4.
|
|
11
|
-
qdrant_haystack-4.
|
|
7
|
+
haystack_integrations/document_stores/qdrant/migrate_to_sparse.py,sha256=yhZr4GB6N1S-Ikzl52hpuZt2aHNIb4leqFDhVMU3Uho,4910
|
|
8
|
+
qdrant_haystack-4.2.0.dist-info/METADATA,sha256=1YbgcocABSF6diKKveRlJg2q1D4IOTYpv9fOWPQJbDk,1863
|
|
9
|
+
qdrant_haystack-4.2.0.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
|
|
10
|
+
qdrant_haystack-4.2.0.dist-info/licenses/LICENSE.txt,sha256=B05uMshqTA74s-0ltyHKI6yoPfJ3zYgQbvcXfDVGFf8,10280
|
|
11
|
+
qdrant_haystack-4.2.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|