Package-level declarations

Types

Link copied to clipboard
data class Hit<T>(val id: PointId, val score: Float, val payload: T?)

A typed search hit: a point id, its similarity score, and the decoded payload.

Link copied to clipboard
class KdrantConfig(val host: String, val port: Int, val apiKey: String? = null, val useTls: Boolean = false, val requestTimeout: Duration = 30.seconds, val connectTimeout: Duration? = null, val socketTimeout: Duration? = null, val maxRetries: Int = 3, val retryBaseDelay: Duration = 500.milliseconds, val retryMaxDelay: Duration = 5.seconds, val dispatcher: CoroutineDispatcher = Dispatchers.IO)

Resolved, immutable connection configuration for a Kdrant client.

Link copied to clipboard

Mutable builder backing the Kdrant(host, port) { ... } configuration DSL.

Link copied to clipboard
annotation class KdrantDsl

DSL marker isolating Kdrant builder scopes (config, points, filters, ...).

Link copied to clipboard
sealed class KdrantException : Exception

Base type for all errors surfaced by a Kdrant client. A sealed hierarchy lets callers exhaustively when over the failure modes.

Link copied to clipboard

The user-facing Kdrant API. Coroutine-first: every operation is a suspend function.

Properties

Link copied to clipboard
val kdrantJson: Json

The default Json Kdrant uses to decode point payloads.

Functions

Link copied to clipboard
suspend fun <T> catching(block: suspend () -> T): Result<T>

Runs block and captures its outcome in a Result, re-throwing CancellationException so coroutine cancellation is never swallowed — unlike the standard-library runCatching, which would trap it.

Link copied to clipboard
suspend fun QdrantClient.createCollection(name: String, size: Long, distance: Distance = Distance.COSINE)

Create a single-vector collection from just a size and distance — the common case.

Link copied to clipboard

Create a collection unless it already exists. Returns true if it was created, false if it already existed.

Link copied to clipboard

Fetch a collection's info, or null if it does not exist — instead of throwing KdrantException.CollectionNotFound.

Link copied to clipboard
fun kdrantConfig(host: String, port: Int, configure: KdrantConfigBuilder.() -> Unit = {}): KdrantConfig

Builds a KdrantConfig from the configuration DSL. Used by transport factories.

Link copied to clipboard
inline fun <T> Record.payloadAs(json: Json = kdrantJson): T?

Decode this record's payload into T with json, or return null if it carries no payload.

inline fun <T> ScoredPoint.payloadAs(json: Json = kdrantJson): T?

Decode this hit's payload into T with json, or return null if the hit carries no payload.

Link copied to clipboard

Wraps a QdrantTransport into a QdrantClient. Used by transport factories.

Link copied to clipboard
inline suspend fun <T> QdrantClient.searchAs(name: String, json: Json = kdrantJson, noinline configure: SearchBuilder.() -> Unit): List<Hit<T>>

Like QdrantClient.search, but decodes each hit's payload into T — the typical RAG read path.