Skip to main content

beir-qdrant

BEIR is a heterogeneous benchmark containing diverse IR tasks. This project integrates BEIR with Qdrant - a vector search engine.

Installation

pip install beir-qdrant

Quick Example

The following example demonstrates how to use BEIR with Qdrant dense search. The example uses the SciFact dataset and all-MiniLM-L6-v2 model from Sentence Transformers to generate the dense embeddings.

from beir import util
from beir.datasets.data_loader import GenericDataLoader
from beir.retrieval.evaluation import EvaluateRetrieval
from qdrant_client import QdrantClient

from beir_qdrant.retrieval.models.fastembed import DenseFastEmbedModelAdapter
from beir_qdrant.retrieval.search.dense import DenseQdrantSearch

# Download and load the dataset
dataset = "scifact"
url = "https://public.ukp.informatik.tu-darmstadt.de/thakur/BEIR/datasets/{}.zip".format(dataset)
data_path = util.download_and_unzip(url, "datasets")
corpus, queries, qrels = GenericDataLoader(data_folder=data_path).load(split="test")

# Connect to Qdrant running on localhost
qdrant_client = QdrantClient("http://localhost:6333")

# Create the retriever and evaluate it on the test set using
# one of the sentence-transformers models available in FastEmbed
model = DenseQdrantSearch(
    qdrant_client,
    model=DenseFastEmbedModelAdapter(
        model_name="sentence-transformers/all-MiniLM-L6-v2"
    ),
    collection_name="scifact-all-MiniLM-L6-v2",
    initialize=True,
)
retriever = EvaluateRetrieval(model)
results = retriever.retrieve(corpus, queries)

ndcg, _map, recall, precision = retriever.evaluate(qrels, results, retriever.k_values)

The example above demonstrates how to use the dense embeddings, but changing the search mode is as simple as changing the model implementation.

Supported Modes

Qdrant supports different search modes, including:

  • Dense search: beir_qdrant.retrieval.search.dense.DenseQdrantSearch
  • Sparse search: beir_qdrant.retrieval.search.sparse.SparseQdrantSearch
  • Multi vector search: beir_qdrant.retrieval.search.multi_vector.MultiVectorQdrantSearch
  • Hybrid search with RRF: beir_qdrant.retrieval.search.hybrid.RRFHybridQdrantSearch
  • Muvera postprocessing for multi vector search: beir_qdrant.retrieval.models.fastembed.MuveraPostprocessorAdapter

Metadata

Release files for beir-qdrant 0.5.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for beir-qdrant 0.5.5
File Size Uploaded Provenance
beir_qdrant-0.5.5.tar.gz 12.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for beir-qdrant 0.5.5
File Interpreter ABI Platform
beir_qdrant-0.5.5-py3-none-any.whl Python 3 none any Details

Total release size: 32.9 kB

Release files / beir_qdrant-0.5.5.tar.gz

Download URL beir_qdrant-0.5.5.tar.gz
Size 12.2 kB
Tags Source
SHA-256 checksum
How to use checksums
bff4bf5d1c7d14f9f65c76bb462660d3724d4d3ba83f57ad51e8e2440a178b0e
BLAKE2b-256 checksum
How to use checksums
dd2c738612ceb39987c99313d82be7a377e899868aec8d864aa0ce42a1b3faa2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.23

Release files / beir_qdrant-0.5.5-py3-none-any.whl

Download URL beir_qdrant-0.5.5-py3-none-any.whl
Size 20.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e789a8eed54e1fc169ce9fcaf1ddc8fc89a74a4e67aeb7c7029d50666aec9fa7
BLAKE2b-256 checksum
How to use checksums
7d9f9683a3ea47ec1d87ac87aab4246e96ad023dab12118343fd8ee9d0f8c6eb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.23

Security for beir-qdrant 0.5.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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