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 = "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.2.0.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.2.0-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: daft_qdrant-0.2.0.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.2.0.tar.gz
Algorithm Hash digest
SHA256 d9f97135c974db74176d4dbbc82af57f04ba4eabf9373a91c25b6b545b3f8ccc
MD5 efd3559bc339f6f86e82f0b4aa4d2a44
BLAKE2b-256 ee679b5183e7dc7bc228e95e452e0d75e1c23634e0950c85ad29551f0a680b42

See more details on using hashes here.

File details

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

File metadata

  • Download URL: daft_qdrant-0.2.0-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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2d660352dd492d7f8b31c5de5f57258d6c79dfca96cff728f7474c4d8fc7c7cf
MD5 de8c33a99775ab95b96817b9481b9d7c
BLAKE2b-256 17946f79cbda90e5ac4f21df079a84f13dbb3fa28beb2bbc78f8670a8ff2ba70

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