Skip to main content

SIE integration for Qdrant

Project description

sie-qdrant

SIE integration for Qdrant.

Installation

pip install sie-qdrant

Dense embeddings

from qdrant_client import QdrantClient
from qdrant_client.models import Distance, VectorParams, PointStruct
from sie_qdrant import SIEVectorizer

vectorizer = SIEVectorizer(base_url="http://localhost:8080", model="BAAI/bge-m3")

qdrant = QdrantClient("http://localhost:6333")
qdrant.create_collection(
    collection_name="documents",
    vectors_config=VectorParams(size=1024, distance=Distance.COSINE),
)

texts = ["first doc", "second doc"]
vectors = vectorizer.embed_documents(texts)
qdrant.upsert(
    collection_name="documents",
    points=[
        PointStruct(id=i, vector=v, payload={"text": t})
        for i, (t, v) in enumerate(zip(texts, vectors))
    ],
)

query_vec = vectorizer.embed_query("search text")
results = qdrant.query_points(
    collection_name="documents", query=query_vec, limit=5
)

Named vectors (dense + sparse)

SIE's multi-output encode produces dense and sparse vectors in one call. Qdrant supports sparse vectors natively via SparseVector(indices, values), so no expansion to full vocabulary length is needed:

from qdrant_client import QdrantClient
from qdrant_client.models import (
    Distance, VectorParams, PointStruct,
    SparseVectorParams, SparseVector,
)
from sie_qdrant import SIENamedVectorizer

vectorizer = SIENamedVectorizer(
    base_url="http://localhost:8080",
    model="BAAI/bge-m3",
    output_types=["dense", "sparse"],
)

qdrant = QdrantClient("http://localhost:6333")
qdrant.create_collection(
    collection_name="documents",
    vectors_config={"dense": VectorParams(size=1024, distance=Distance.COSINE)},
    sparse_vectors_config={"sparse": SparseVectorParams()},
)

named = vectorizer.embed_documents(["hello world"])
qdrant.upsert(
    collection_name="documents",
    points=[
        PointStruct(
            id=0,
            vector={
                "dense": named[0]["dense"],
                "sparse": SparseVector(**named[0]["sparse"]),
            },
            payload={"text": "hello world"},
        )
    ],
)

Storage advantage: Unlike integrations that expand sparse vectors to full vocabulary length (~30K floats), Qdrant stores sparse vectors in their native indices+values form, making hybrid search storage-efficient.

Testing

# Unit tests (no server needed)
pytest

# Integration tests (requires SIE + Qdrant)
pytest -m integration

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

sie_qdrant-0.6.16.tar.gz (10.0 kB view details)

Uploaded Source

Built Distribution

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

sie_qdrant-0.6.16-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file sie_qdrant-0.6.16.tar.gz.

File metadata

  • Download URL: sie_qdrant-0.6.16.tar.gz
  • Upload date:
  • Size: 10.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for sie_qdrant-0.6.16.tar.gz
Algorithm Hash digest
SHA256 b5a67b11462dd7e125853c4430be5cbebdc771216b0e0f6ef0a7aee8c797ef6d
MD5 b9b44d30633ed00a0953ab5fa3b532b8
BLAKE2b-256 77c821cc9d2bbf93e8e7cc0a216fe37615d2f087af0c849457d80dafec55663a

See more details on using hashes here.

Provenance

The following attestation bundles were made for sie_qdrant-0.6.16.tar.gz:

Publisher: release-python.yml on superlinked/sie-internal

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sie_qdrant-0.6.16-py3-none-any.whl.

File metadata

  • Download URL: sie_qdrant-0.6.16-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for sie_qdrant-0.6.16-py3-none-any.whl
Algorithm Hash digest
SHA256 adb0c2742ff19e95c7aeae66f31684f59b16e6ed9d77d69feaad99e244f9fe2a
MD5 bc0d4d8da0d14433eea55a0ac8ecf848
BLAKE2b-256 998935a8c52b34bb2794ba8a052167194b3ebf6a886078b97d2826a16d1eae0d

See more details on using hashes here.

Provenance

The following attestation bundles were made for sie_qdrant-0.6.16-py3-none-any.whl:

Publisher: release-python.yml on superlinked/sie-internal

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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