Skip to main content

Qdrant community extension for Daft

Project description

daft-qdrant

Community extension for Daft to write vector embeddings and their payloads into Qdrant collections.

Installation

pip install daft-qdrant

Quick start

import daft
import daft_qdrant  # registers DataFrame.write_qdrant

df = daft.from_pydict({
    "id": [1, 2, 3],
    "vector": [[0.1, 0.2, 0.3], [0.4, 0.5, 0.6], [0.7, 0.8, 0.9]],
    "label": ["cat", "dog", "bird"],
})

df.write_qdrant("my-collection", url="http://localhost:6333")

The target collection must exist before writing. Each row becomes a Qdrant point:

  • id column → point id (unsigned integer or UUID string)
  • vector column → point vector (list of floats, or dict for named vectors)
  • all other columns → point payload

Embedding pipeline example

import os
import daft
import daft_qdrant
from daft.functions import monotonically_increasing_id
from daft.functions.ai import embed_text
from qdrant_client import QdrantClient, models

url = os.getenv("QDRANT_URL", "http://localhost:6333")
vector_size = 768

QdrantClient(url=url).create_collection(
    "daft-qdrant-example",
    vectors_config=models.VectorParams(size=vector_size, distance=models.Distance.COSINE),
)

(
    daft.read_huggingface("Open-Orca/OpenOrca")
    .limit(100)
    .with_column(
        "vector",
        embed_text(daft.col("response"), provider="sentence_transformers", model="BAAI/bge-base-en-v1.5"),
    )
    .with_column("id", monotonically_increasing_id())
    .write_qdrant("daft-qdrant-example", url=url)
)

Routing rows to multiple collections

Pass a Daft expression as collection_name to route rows to different collections based on a column value:

df.write_qdrant(daft.col("collection"), url="http://localhost:6333")

Column remapping

Use id_column and vector_column to map differently named columns to the required id and vector roles:

df.write_qdrant(
    "my-collection",
    url="http://localhost:6333",
    id_column="doc_id",
    vector_column="embedding",
)

Links

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

daft_qdrant-0.1.1.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

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

daft_qdrant-0.1.1-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file daft_qdrant-0.1.1.tar.gz.

File metadata

  • Download URL: daft_qdrant-0.1.1.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for daft_qdrant-0.1.1.tar.gz
Algorithm Hash digest
SHA256 c75d1c7add6336a2d06144fd61903601118c05dfbfd8a4175fbd59ec444e870c
MD5 640ff1469acc98fe002f9783036a9f8e
BLAKE2b-256 26bc96c3b112c4559270ca5cbc56856d74e7073fe671f218e4891bf39989cd32

See more details on using hashes here.

File details

Details for the file daft_qdrant-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: daft_qdrant-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for daft_qdrant-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5e5fe8327aa86b2babf4f15f534fffc2e01c47b7aead0768bc3d97d6f3649e75
MD5 fb6b78d67e3432864d183bc614a2656e
BLAKE2b-256 cbff2b36d5f660ed3a52bfa1e4ef936debb6d90a0b1c9c3b5a9ec28af9844743

See more details on using hashes here.

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