qdrant-haystack 0.0.2__tar.gz → 0.0.3__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.
Potentially problematic release.
This version of qdrant-haystack might be problematic. Click here for more details.
- qdrant_haystack-0.0.3/PKG-INFO +57 -0
- qdrant_haystack-0.0.3/README.md +39 -0
- {qdrant_haystack-0.0.2 → qdrant_haystack-0.0.3}/pyproject.toml +3 -3
- qdrant_haystack-0.0.3/setup.py +34 -0
- {qdrant_haystack-0.0.2 → qdrant_haystack-0.0.3}/src/qdrant_haystack/document_stores/qdrant.py +26 -13
- qdrant_haystack-0.0.2/PKG-INFO +0 -21
- qdrant_haystack-0.0.2/README.md +0 -3
- qdrant_haystack-0.0.2/setup.py +0 -34
- {qdrant_haystack-0.0.2 → qdrant_haystack-0.0.3}/LICENSE +0 -0
- {qdrant_haystack-0.0.2 → qdrant_haystack-0.0.3}/src/qdrant_haystack/__init__.py +0 -0
- {qdrant_haystack-0.0.2 → qdrant_haystack-0.0.3}/src/qdrant_haystack/document_stores/__init__.py +0 -0
- {qdrant_haystack-0.0.2 → qdrant_haystack-0.0.3}/src/qdrant_haystack/document_stores/converters.py +0 -0
- {qdrant_haystack-0.0.2 → qdrant_haystack-0.0.3}/src/qdrant_haystack/document_stores/filters.py +0 -0
- {qdrant_haystack-0.0.2 → qdrant_haystack-0.0.3}/src/qdrant_haystack/utils.py +0 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: qdrant-haystack
|
|
3
|
+
Version: 0.0.3
|
|
4
|
+
Summary: An integration of Qdrant ANN vector database backend with Haystack
|
|
5
|
+
License: Apache 2.0
|
|
6
|
+
Author: Kacper Łukawski
|
|
7
|
+
Author-email: kacper.lukawski@qdrant.com
|
|
8
|
+
Requires-Python: >=3.8.1,<=3.11
|
|
9
|
+
Classifier: License :: Other/Proprietary License
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Requires-Dist: farm-haystack (>=1.13.0,<2.0.0)
|
|
15
|
+
Requires-Dist: qdrant-client (>=1.0.2,<2.0.0)
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
|
|
18
|
+
# qdrant-haystack
|
|
19
|
+
|
|
20
|
+
An integration of [Qdrant](https://qdrant.tech) vector database with [Haystack](https://haystack.deepset.ai/)
|
|
21
|
+
by [deepset](https://www.deepset.ai).
|
|
22
|
+
|
|
23
|
+
The library finally allows using Qdrant as a document store, and provides an in-place replacement
|
|
24
|
+
for any other vector embeddings store. Thus, you should expect any kind of application to be working
|
|
25
|
+
smoothly just by changing the provider to `QdrantDocumentStore`.
|
|
26
|
+
|
|
27
|
+
## Installation
|
|
28
|
+
|
|
29
|
+
`qdrant-haystack` might be installed as any other Python library, using pip or poetry:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
pip install qdrant-haystack
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
poetry add qdrant-haystack
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Usage
|
|
40
|
+
|
|
41
|
+
Once installed, you can already start using `QdrantDocumentStore` as any other store that supports
|
|
42
|
+
embeddings.
|
|
43
|
+
|
|
44
|
+
```python
|
|
45
|
+
from qdrant_haystack import QdrantDocumentStore
|
|
46
|
+
|
|
47
|
+
document_store = QdrantDocumentStore(
|
|
48
|
+
host="localhost",
|
|
49
|
+
index="Document",
|
|
50
|
+
embedding_dim=512,
|
|
51
|
+
recreate_index=True,
|
|
52
|
+
)
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
The list of parameters accepted by `QdrantDocumentStore` is complementary to those used in the
|
|
56
|
+
official [Python Qdrant client](https://github.com/qdrant/qdrant_client).
|
|
57
|
+
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# qdrant-haystack
|
|
2
|
+
|
|
3
|
+
An integration of [Qdrant](https://qdrant.tech) vector database with [Haystack](https://haystack.deepset.ai/)
|
|
4
|
+
by [deepset](https://www.deepset.ai).
|
|
5
|
+
|
|
6
|
+
The library finally allows using Qdrant as a document store, and provides an in-place replacement
|
|
7
|
+
for any other vector embeddings store. Thus, you should expect any kind of application to be working
|
|
8
|
+
smoothly just by changing the provider to `QdrantDocumentStore`.
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
`qdrant-haystack` might be installed as any other Python library, using pip or poetry:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
pip install qdrant-haystack
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
poetry add qdrant-haystack
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
Once installed, you can already start using `QdrantDocumentStore` as any other store that supports
|
|
25
|
+
embeddings.
|
|
26
|
+
|
|
27
|
+
```python
|
|
28
|
+
from qdrant_haystack import QdrantDocumentStore
|
|
29
|
+
|
|
30
|
+
document_store = QdrantDocumentStore(
|
|
31
|
+
host="localhost",
|
|
32
|
+
index="Document",
|
|
33
|
+
embedding_dim=512,
|
|
34
|
+
recreate_index=True,
|
|
35
|
+
)
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
The list of parameters accepted by `QdrantDocumentStore` is complementary to those used in the
|
|
39
|
+
official [Python Qdrant client](https://github.com/qdrant/qdrant_client).
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "qdrant-haystack"
|
|
3
|
-
version = "0.0.
|
|
3
|
+
version = "0.0.3"
|
|
4
4
|
description = "An integration of Qdrant ANN vector database backend with Haystack"
|
|
5
5
|
authors = ["Kacper Łukawski <kacper.lukawski@qdrant.com>"]
|
|
6
6
|
packages = [
|
|
@@ -11,12 +11,12 @@ license = "Apache 2.0"
|
|
|
11
11
|
|
|
12
12
|
[tool.poetry.dependencies]
|
|
13
13
|
python = ">=3.8.1,<=3.11"
|
|
14
|
-
qdrant-client = "^1.0.
|
|
14
|
+
qdrant-client = "^1.0.2"
|
|
15
15
|
farm-haystack = "^1.13.0"
|
|
16
16
|
|
|
17
17
|
[tool.poetry.dev-dependencies]
|
|
18
18
|
pytest = "^7.1"
|
|
19
|
-
pre-commit = "^
|
|
19
|
+
pre-commit = "^3.1.0"
|
|
20
20
|
black = "^23.1.0"
|
|
21
21
|
isort = "^5.12.0"
|
|
22
22
|
mypy = "^1.0.1"
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
from setuptools import setup
|
|
3
|
+
|
|
4
|
+
package_dir = \
|
|
5
|
+
{'': 'src'}
|
|
6
|
+
|
|
7
|
+
packages = \
|
|
8
|
+
['qdrant_haystack', 'qdrant_haystack.document_stores']
|
|
9
|
+
|
|
10
|
+
package_data = \
|
|
11
|
+
{'': ['*']}
|
|
12
|
+
|
|
13
|
+
install_requires = \
|
|
14
|
+
['farm-haystack>=1.13.0,<2.0.0', 'qdrant-client>=1.0.2,<2.0.0']
|
|
15
|
+
|
|
16
|
+
setup_kwargs = {
|
|
17
|
+
'name': 'qdrant-haystack',
|
|
18
|
+
'version': '0.0.3',
|
|
19
|
+
'description': 'An integration of Qdrant ANN vector database backend with Haystack',
|
|
20
|
+
'long_description': '# qdrant-haystack\n\nAn integration of [Qdrant](https://qdrant.tech) vector database with [Haystack](https://haystack.deepset.ai/)\nby [deepset](https://www.deepset.ai).\n\nThe library finally allows using Qdrant as a document store, and provides an in-place replacement\nfor any other vector embeddings store. Thus, you should expect any kind of application to be working\nsmoothly just by changing the provider to `QdrantDocumentStore`.\n\n## Installation\n\n`qdrant-haystack` might be installed as any other Python library, using pip or poetry:\n\n```bash\npip install qdrant-haystack\n```\n\n```bash\npoetry add qdrant-haystack\n```\n\n## Usage\n\nOnce installed, you can already start using `QdrantDocumentStore` as any other store that supports\nembeddings.\n\n```python\nfrom qdrant_haystack import QdrantDocumentStore\n\ndocument_store = QdrantDocumentStore(\n host="localhost",\n index="Document",\n embedding_dim=512,\n recreate_index=True,\n)\n```\n\nThe list of parameters accepted by `QdrantDocumentStore` is complementary to those used in the\nofficial [Python Qdrant client](https://github.com/qdrant/qdrant_client).\n',
|
|
21
|
+
'author': 'Kacper Łukawski',
|
|
22
|
+
'author_email': 'kacper.lukawski@qdrant.com',
|
|
23
|
+
'maintainer': 'None',
|
|
24
|
+
'maintainer_email': 'None',
|
|
25
|
+
'url': 'None',
|
|
26
|
+
'package_dir': package_dir,
|
|
27
|
+
'packages': packages,
|
|
28
|
+
'package_data': package_data,
|
|
29
|
+
'install_requires': install_requires,
|
|
30
|
+
'python_requires': '>=3.8.1,<=3.11',
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
setup(**setup_kwargs)
|
{qdrant_haystack-0.0.2 → qdrant_haystack-0.0.3}/src/qdrant_haystack/document_stores/qdrant.py
RENAMED
|
@@ -3,18 +3,22 @@ from typing import Any, Dict, Generator, List, Optional, Union, cast
|
|
|
3
3
|
|
|
4
4
|
import numpy as np
|
|
5
5
|
import qdrant_client
|
|
6
|
+
from grpc._channel import _InactiveRpcError
|
|
6
7
|
from haystack import Document, Label
|
|
7
8
|
from haystack.document_stores import BaseDocumentStore
|
|
8
9
|
from haystack.document_stores.base import get_batches_from_generator
|
|
9
10
|
from haystack.errors import DocumentStoreError
|
|
10
11
|
from haystack.nodes import DenseRetriever
|
|
11
12
|
from haystack.schema import FilterType
|
|
13
|
+
from qdrant_client import grpc
|
|
12
14
|
from qdrant_client.http import models as rest
|
|
13
15
|
from qdrant_client.http.exceptions import UnexpectedResponse
|
|
14
16
|
from tqdm import tqdm
|
|
15
17
|
|
|
16
|
-
from qdrant_haystack.document_stores.converters import (
|
|
17
|
-
|
|
18
|
+
from qdrant_haystack.document_stores.converters import (
|
|
19
|
+
HaystackToQdrant,
|
|
20
|
+
QdrantToHaystack,
|
|
21
|
+
)
|
|
18
22
|
from qdrant_haystack.document_stores.filters import QdrantFilterConverter
|
|
19
23
|
|
|
20
24
|
logger = logging.getLogger(__name__)
|
|
@@ -114,17 +118,21 @@ class QdrantDocumentStore(BaseDocumentStore):
|
|
|
114
118
|
qdrant_filters = self.qdrant_filter_converter.convert(filters)
|
|
115
119
|
|
|
116
120
|
next_offset = None
|
|
117
|
-
|
|
118
|
-
while
|
|
121
|
+
stop_scrolling = False
|
|
122
|
+
while not stop_scrolling:
|
|
119
123
|
records, next_offset = self.client.scroll(
|
|
120
124
|
collection_name=index,
|
|
121
125
|
scroll_filter=qdrant_filters,
|
|
122
126
|
limit=batch_size,
|
|
123
127
|
offset=next_offset,
|
|
124
128
|
with_payload=True,
|
|
125
|
-
with_vectors=
|
|
129
|
+
with_vectors=True,
|
|
130
|
+
)
|
|
131
|
+
stop_scrolling = next_offset is None or (
|
|
132
|
+
isinstance(next_offset, grpc.PointId)
|
|
133
|
+
and next_offset.num == 0
|
|
134
|
+
and next_offset.uuid == ""
|
|
126
135
|
)
|
|
127
|
-
continue_scroll = next_offset is not None
|
|
128
136
|
|
|
129
137
|
for record in records:
|
|
130
138
|
yield self.qdrant_to_haystack.point_to_document(record)
|
|
@@ -149,19 +157,24 @@ class QdrantDocumentStore(BaseDocumentStore):
|
|
|
149
157
|
) -> List[Document]:
|
|
150
158
|
index = index or self.index
|
|
151
159
|
|
|
152
|
-
next_offset = None
|
|
153
|
-
continue_scroll = True
|
|
154
160
|
documents: List[Document] = []
|
|
155
|
-
|
|
161
|
+
|
|
162
|
+
next_offset = None
|
|
163
|
+
stop_scrolling = False
|
|
164
|
+
while not stop_scrolling:
|
|
156
165
|
records, next_offset = self.client.scroll(
|
|
157
166
|
collection_name=index,
|
|
158
167
|
scroll_filter=self.qdrant_filter_converter.convert(None, ids),
|
|
159
168
|
limit=batch_size,
|
|
160
169
|
offset=next_offset,
|
|
161
170
|
with_payload=True,
|
|
162
|
-
with_vectors=
|
|
171
|
+
with_vectors=True,
|
|
172
|
+
)
|
|
173
|
+
stop_scrolling = next_offset is None or (
|
|
174
|
+
isinstance(next_offset, grpc.PointId)
|
|
175
|
+
and next_offset.num == 0
|
|
176
|
+
and next_offset.uuid == ""
|
|
163
177
|
)
|
|
164
|
-
continue_scroll = next_offset is not None
|
|
165
178
|
|
|
166
179
|
for record in records:
|
|
167
180
|
documents.append(self.qdrant_to_haystack.point_to_document(record))
|
|
@@ -338,7 +351,7 @@ class QdrantDocumentStore(BaseDocumentStore):
|
|
|
338
351
|
embedding_dim=self.embedding_dim,
|
|
339
352
|
field_map=self._create_document_field_map(),
|
|
340
353
|
)
|
|
341
|
-
self.client.upsert(
|
|
354
|
+
response = self.client.upsert(
|
|
342
355
|
collection_name=index,
|
|
343
356
|
points=batch,
|
|
344
357
|
)
|
|
@@ -486,7 +499,7 @@ class QdrantDocumentStore(BaseDocumentStore):
|
|
|
486
499
|
f"If you want to use that collection, but with a different "
|
|
487
500
|
f"vector size, please set `recreate_collection=True` argument."
|
|
488
501
|
)
|
|
489
|
-
except UnexpectedResponse:
|
|
502
|
+
except (UnexpectedResponse, _InactiveRpcError):
|
|
490
503
|
# That indicates the collection does not exist, so it can be
|
|
491
504
|
# safely created with any configuration.
|
|
492
505
|
self._recreate_collection(collection_name, distance, embedding_dim)
|
qdrant_haystack-0.0.2/PKG-INFO
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: qdrant-haystack
|
|
3
|
-
Version: 0.0.2
|
|
4
|
-
Summary: An integration of Qdrant ANN vector database backend with Haystack
|
|
5
|
-
License: Apache 2.0
|
|
6
|
-
Author: Kacper Łukawski
|
|
7
|
-
Author-email: kacper.lukawski@qdrant.com
|
|
8
|
-
Requires-Python: >=3.8.1,<=3.11
|
|
9
|
-
Classifier: License :: Other/Proprietary License
|
|
10
|
-
Classifier: Programming Language :: Python :: 3
|
|
11
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
-
Requires-Dist: farm-haystack (>=1.13.0,<2.0.0)
|
|
15
|
-
Requires-Dist: qdrant-client (>=1.0.1,<2.0.0)
|
|
16
|
-
Description-Content-Type: text/markdown
|
|
17
|
-
|
|
18
|
-
# qdrant-haystack
|
|
19
|
-
|
|
20
|
-
An integration of Qdrant ANN vector database backend with Haystack
|
|
21
|
-
|
qdrant_haystack-0.0.2/README.md
DELETED
qdrant_haystack-0.0.2/setup.py
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
from setuptools import setup
|
|
3
|
-
|
|
4
|
-
package_dir = \
|
|
5
|
-
{'': 'src'}
|
|
6
|
-
|
|
7
|
-
packages = \
|
|
8
|
-
['qdrant_haystack', 'qdrant_haystack.document_stores']
|
|
9
|
-
|
|
10
|
-
package_data = \
|
|
11
|
-
{'': ['*']}
|
|
12
|
-
|
|
13
|
-
install_requires = \
|
|
14
|
-
['farm-haystack>=1.13.0,<2.0.0', 'qdrant-client>=1.0.1,<2.0.0']
|
|
15
|
-
|
|
16
|
-
setup_kwargs = {
|
|
17
|
-
'name': 'qdrant-haystack',
|
|
18
|
-
'version': '0.0.2',
|
|
19
|
-
'description': 'An integration of Qdrant ANN vector database backend with Haystack',
|
|
20
|
-
'long_description': '# qdrant-haystack\n\nAn integration of Qdrant ANN vector database backend with Haystack \n',
|
|
21
|
-
'author': 'Kacper Łukawski',
|
|
22
|
-
'author_email': 'kacper.lukawski@qdrant.com',
|
|
23
|
-
'maintainer': 'None',
|
|
24
|
-
'maintainer_email': 'None',
|
|
25
|
-
'url': 'None',
|
|
26
|
-
'package_dir': package_dir,
|
|
27
|
-
'packages': packages,
|
|
28
|
-
'package_data': package_data,
|
|
29
|
-
'install_requires': install_requires,
|
|
30
|
-
'python_requires': '>=3.8.1,<=3.11',
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
setup(**setup_kwargs)
|
|
File without changes
|
|
File without changes
|
{qdrant_haystack-0.0.2 → qdrant_haystack-0.0.3}/src/qdrant_haystack/document_stores/__init__.py
RENAMED
|
File without changes
|
{qdrant_haystack-0.0.2 → qdrant_haystack-0.0.3}/src/qdrant_haystack/document_stores/converters.py
RENAMED
|
File without changes
|
{qdrant_haystack-0.0.2 → qdrant_haystack-0.0.3}/src/qdrant_haystack/document_stores/filters.py
RENAMED
|
File without changes
|
|
File without changes
|