Qdrant vector database bindings — the self-hosted/open-source RAG
store (Qdrant Cloud works identically). Same shape as the pinecone
package: collections + points.
Setup — context variables:
qdrant.url— e.g.http://localhost:6333or your cloud cluster URLqdrant.api.key— optional for local, required for cloud
Every API function also takes a trailing opts Map, so one run can use
several instances: {url: ..., api-key: ...} replaces the context
values for that call. A per-call url never borrows the context key.
Quick start
::qd ::qdrant
::qd/create-collection("docs", 3)
::qd/upsert-points("docs", [
{id: 1, vector: [0.12, 0.48, 0.91], payload: {source: "guide.md"}}
])
hits ::qd/search("docs", {vector: [0.1, 0.5, 0.9], limit: 5, with_payload: true})
map(hits, (h) { h.payload.source })
Functions
base-url
fn (): Str
fn (url: Str): Str
The instance URL without a trailing slash: the qdrant.url context
variable or the local default, or the given URL.
Example
::qdrant/base-url("http://localhost:6333/") // "http://localhost:6333"
qdrant.url
count-points
fn (collection: Str): Map
fn (collection: Str, filter: Map): Map
fn (collection: Str, filter: Map, opts: Map): Map
POST /collections/{name}/points/count - Count points, optionally under a filter.
Example
all ::qdrant/count-points("docs")
all.count
// Under a filter
english ::qdrant/count-points("docs", {must: [{key: "lang", match: {value: "en"}}]})
english.count
create-collection
fn (name: Str, dimension: Int): Any
fn (name: Str, dimension: Int, opts: Map): Any
fn (name: Str, dimension: Int, distance: Str): Any
fn (name: Str, dimension: Int, distance: Str, opts: Map): Any
PUT /collections/{name} - Create a collection. The 3-arity form sets the
distance metric ("Cosine" default, "Euclid", "Dot") or takes opts; the
4-arity form takes both.
Example
::qdrant/create-collection("docs", 1536)
// Dot product, on another instance
::qdrant/create-collection("docs", 1536, "Dot", {
url: "https://tenant-b.qdrant.example",
api-key: ::hot::ctx/get("tenant-b.qdrant.api.key")
})
delete-collection
fn (name: Str): Any
fn (name: Str, opts: Map): Any
DELETE /collections/{name} - Drop a collection and its points.
Example
::qdrant/delete-collection("docs")
delete-points
fn (collection: Str, selector: Map): Any
fn (collection: Str, selector: Map, opts: Map): Any
POST /collections/{name}/points/delete - Delete by ids ({points: [...]}) or by filter ({filter: {...}}).
Example
::qdrant/delete-points("docs", {points: [1, 2]})
// Everything matching a filter
::qdrant/delete-points("docs", {filter: {must: [{key: "lang", match: {value: "de"}}]}})
get-collection
fn (name: Str): Map
fn (name: Str, opts: Map): Map
GET /collections/{name} - Collection info: vector config, point count, status.
Example
info ::qdrant/get-collection("docs")
info.points_count
get-points
fn (collection: Str, ids: Vec): Vec
fn (collection: Str, ids: Vec, opts: Map): Vec
POST /collections/{name}/points - Retrieve points by ids (payloads included).
Example
points ::qdrant/get-points("docs", [1, 2])
map(points, (p) { p.payload })
list-collections
fn (): Map
fn (opts: Map): Map
GET /collections - The instance's collections.
Example
out ::qdrant/list-collections()
map(out.collections, (c) { c.name })
qdrant.url, qdrant.api.key
request
fn (method: Str, path: Str, body: Any): Any
fn (method: Str, path: Str, body: Any, opts: Map): Any
fn (method: Str, path: Str, body: Any, url: Str, api-key: Str): Any
The request behind every function: opts ({url, api-key}), then the
context variables, then the local default (see ::qdrant::api/resolve).
Example
// A route the package does not wrap. "" sends no body.
out ::qdrant/request("GET", "/collections/docs/aliases", "")
out.aliases
// Against another instance
::qdrant/request("GET", "/collections", "", {
url: "https://tenant-b.qdrant.example",
api-key: ::hot::ctx/get("tenant-b.qdrant.api.key")
})
qdrant.url, qdrant.api.key
search
fn (collection: Str, options: Map): Vec
fn (collection: Str, options: Map, opts: Map): Vec
POST /collections/{name}/points/search - Nearest-neighbor search.
options: vector (required), limit (default 10), filter
(Qdrant filter DSL), with_payload, with_vector,
score_threshold. Returns the hits ([{id, score, payload?}]).
Example
hits ::qdrant/search("docs", {
vector: [0.1, 0.5, 0.9],
limit: 5,
filter: {must: [{key: "lang", match: {value: "en"}}]},
with_payload: true
})
first(hits).payload
upsert-points
fn (collection: Str, points: Vec): Any
fn (collection: Str, points: Vec, opts: Map): Any
PUT /collections/{name}/points - Upsert points: [{id, vector, payload?}] (ids are ints or UUIDs).
Example
::qdrant/upsert-points("docs", [
{id: 1, vector: [0.12, 0.48, 0.91], payload: {title: "Q3 roadmap", lang: "en"}}
])