Skip to main content

An integration of Qdrant ANN vector database backend with Haystack

Project description

qdrant-haystack

An integration of Qdrant vector database with Haystack by deepset.

The library finally allows using Qdrant as a document store, and provides an in-place replacement for any other vector embeddings store. Thus, you should expect any kind of application to be working smoothly just by changing the provider to QdrantDocumentStore.

Installation

qdrant-haystack might be installed as any other Python library, using pip or poetry:

pip install qdrant-haystack
poetry add qdrant-haystack

Usage

Once installed, you can already start using QdrantDocumentStore as any other store that supports embeddings.

from qdrant_haystack import QdrantDocumentStore

document_store = QdrantDocumentStore(
    "localhost",
    index="Document",
    embedding_dim=512,
    recreate_index=True,
    hnsw_config={"m": 16, "ef_construct": 64}  # Optional
)

The list of parameters accepted by QdrantDocumentStore is complementary to those used in the official Python Qdrant client.

Using local in-memory / disk-persisted mode

Qdrant Python client, from version 1.1.1, supports local in-memory/disk-persisted mode. That's a good choice for any test scenarios and quick experiments in which you do not plan to store lots of vectors. In such a case spinning a Docker container might be even not required.

The local mode was also implemented in qdrant-haystack integration.

In-memory storage

In case you want to have a transient storage, for example in case of automated tests launched during your CI/CD pipeline, using Qdrant Local mode with in-memory storage might be a preferred option. It might be simply enabled by passing :memory: as first parameter, while creating an instance of QdrantDocumentStore.

from qdrant_haystack import QdrantDocumentStore

document_store = QdrantDocumentStore(
    ":memory:",
    index="Document",
    embedding_dim=512,
    recreate_index=True,
    hnsw_config={"m": 16, "ef_construct": 64}  # Optional
)

On disk storage

However, if you prefer to keep the vectors between different runs of your application, it might be better to use on disk storage and pass the path that should be used to persist the data.

from qdrant_haystack import QdrantDocumentStore

document_store = QdrantDocumentStore(
    path="/home/qdrant/storage_local",
    index="Document",
    embedding_dim=512,
    recreate_index=True,
    hnsw_config={"m": 16, "ef_construct": 64}  # Optional
)

Connecting to Qdrant Cloud cluster

If you prefer not to manage your own Qdrant instance, Qdrant Cloud might be a better option.

from qdrant_haystack import QdrantDocumentStore

document_store = QdrantDocumentStore(
    "https://YOUR-CLUSTER-URL.aws.cloud.qdrant.io",
    index="Document",
    api_key="<< YOUR QDRANT CLOUD API KEY >>",
    embedding_dim=512,
    recreate_index=True,
)

There is no difference in terms of functionality between local instances and cloud clusters.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

qdrant_haystack-1.0.9.tar.gz (13.5 kB view details)

Uploaded Source

Built Distribution

qdrant_haystack-1.0.9-py3-none-any.whl (14.4 kB view details)

Uploaded Python 3

File details

Details for the file qdrant_haystack-1.0.9.tar.gz.

File metadata

  • Download URL: qdrant_haystack-1.0.9.tar.gz
  • Upload date:
  • Size: 13.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for qdrant_haystack-1.0.9.tar.gz
Algorithm Hash digest
SHA256 44ddd3ff22859c1ac7f9e088f650f397e88bf2fae76f57f214b530ae690c1abd
MD5 b4cfd1721dc9011477aa9895172b0b28
BLAKE2b-256 4ad55dd98fe7eb014ffd8620ca83727203698fa497bd43cf0fa974305b0108bd

See more details on using hashes here.

File details

Details for the file qdrant_haystack-1.0.9-py3-none-any.whl.

File metadata

File hashes

Hashes for qdrant_haystack-1.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 da6ba12793d7fa4d008e66fd6f207fca2e52f068cc2f3e43f7a65c018fb0e191
MD5 6f4157f289b5b59cb70d32735c057dfb
BLAKE2b-256 71dea29225d2bd2e3a39b6613e5625b84993acfa854db3a90f62a7a1cf2eeae3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page