InferenceInput

@Serializable(with = InferenceInputSerializer::class)
sealed interface InferenceInput

What the server should embed, and with which model.

Kdrant does not generate embeddings: it bundles no model, takes no dependency on an inference library, and never sends a vector it computed itself. This type is not an exception to that. It is a request that names text, an image or a custom object together with a model, exactly as a filter names what to match, and Qdrant produces the vector on its own side. The models, the providers and the cost of running them stay where they are.

qdrant.upsert("docs", wait = true) {
point(1) { document("the text to embed", model = "jinaai/jina-embeddings-v2-base-en") }
}
val hits = qdrant.search("docs") {
query(InferenceInput.Document("what to look for", model = "jinaai/jina-embeddings-v2-base-en"))
}

The request needs a Qdrant with an inference provider configured; a plain container has none and rejects it. That is the server's deployment rather than the client's capability, which is why this is a request shape the contract tests validate against Qdrant's own schema and a round trip that runs only where a provider exists.

The three shapes are distinguished by the field they carry — text, image, object — rather than by a discriminator, which is why they serialize through a hand-written serializer instead of the generated polymorphic one.

Inheritors

Types

Link copied to clipboard
@Serializable
data class Custom(val value: JsonElement, val model: String, val options: Map<String, JsonElement>? = null) : InferenceInput

Arbitrary input, for a model that takes something other than one document or one image.

Link copied to clipboard
@Serializable
data class Document(val text: String, val model: String, val options: Map<String, JsonElement>? = null) : InferenceInput

Text to embed.

Link copied to clipboard
@Serializable
data class Image(val image: JsonElement, val model: String, val options: Map<String, JsonElement>? = null) : InferenceInput

An image to embed, as a URL or as base64-encoded bytes. image is untyped because Qdrant accepts either, and which one a provider wants is the provider's business.

Properties

Link copied to clipboard
abstract val model: String

The model that produces the vector. Which names are valid depends on the server's provider.

Link copied to clipboard
abstract val options: Map<String, JsonElement>?

Model-specific options, passed to the inference service as they are.