Skip to main content

Cognee Qdrant Adapter

Installation

If published, the package can be simply installed via pip:

pip install cognee-community-vector-adapter-qdrant

In case it is not published yet, you can use poetry to locally build the adapter package:

pip install poetry
poetry install # run this command in the directory containing the pyproject.toml file

Connection Setup

For a quick local setup, you can run a docker container that qdrant provides (https://qdrant.tech/documentation/quickstart/). After this, you will be able to connect to the Qdrant DB through the appropriate ports. The command for running the docker container looks something like the following:

docker run -p 6333:6333 -p 6334:6334 \
    -v "$(pwd)/qdrant_storage:/qdrant/storage:z" \
    qdrant/qdrant

Usage

Import and register the adapter in your code:

from cognee_community_vector_adapter_qdrant import register

Also, specify the dataset handler in the .env file:

VECTOR_DATASET_DATABASE_HANDLER="qdrant"

Quantization

The adapter supports Qdrant's quantization methods, including TurboQuant (introduced in Qdrant 1.18). Quantization compresses stored vectors and reduces memory cost; it is disabled by default.

Mode Compression Notes
tq4 8x TurboQuant 4-bit. Recommended default; SQ-level recall
tq2 16x TurboQuant 2-bit. Beats binary 2-bit by 9–24 pp
tq1.5 ~21x TurboQuant 1.5-bit
tq1 32x TurboQuant 1-bit. Beats binary 1-bit by 9–21 pp
sq 4x Scalar int8 — safe baseline
bq1 32x Binary 1-bit
bq2 16x Binary 2-bit
pq 16x Product quantization (compression ratio X16)
none 1x No quantization (default, backward-compatible)

Set the mode via env var:

QDRANT_QUANTIZATION=tq4
QDRANT_QUANTIZATION_ALWAYS_RAM=true
QDRANT_QUANTIZATION_RESCORE=true
QDRANT_QUANTIZATION_OVERSAMPLING=2.0

Requires qdrant-client>=1.18 and Qdrant server >=1.18 for any tq* mode.

Migrating existing collections

Setting QDRANT_QUANTIZATION only affects newly created collections. To enable quantization on an existing collection without re-ingesting data, call update_quantization:

from cognee.infrastructure.databases.vector import get_vector_engine

adapter = get_vector_engine()
await adapter.update_quantization("Entity_name")
await adapter.update_quantization("DocumentChunk_text")

Qdrant rebuilds the affected index in the background; queries during the rebuild transparently fall back to full vectors.

Example

See example in example.py file.

Download files

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

Source Distribution

cognee_community_vector_adapter_qdrant-0.4.0.tar.gz (12.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file cognee_community_vector_adapter_qdrant-0.4.0.tar.gz.

File metadata

File hashes

Hashes for cognee_community_vector_adapter_qdrant-0.4.0.tar.gz
Algorithm Hash digest
SHA256 780efabe4e96c30a6196f0154e1dbcf1f241beff87f25c139533d996f952028f
MD5 7c8b0ff93b10ce71dc68a217eac98532
BLAKE2b-256 8886b2079af9838d6cea62e67481255ec0d7c65df84a008d3564c3b22da72610

See more details on using hashes here.

File details

Details for the file cognee_community_vector_adapter_qdrant-0.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for cognee_community_vector_adapter_qdrant-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3cc6d77062711eaf5b5a1b9170b9e418c32038ef5d2f0b4834420d130140d5d2
MD5 0adbe40c919fc2ed57c60c2aaeb9d6d3
BLAKE2b-256 2640c09ee2315c2d907dea9a45dcad51906b3deb599f857314d03d1203f90dea

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 files

0.2.4

2 files

0.2.3

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

0.1.0

2 files

0.0.3

2 files

0.0.2

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page