Configuration

July 31, 2026 · View on GitHub

QdrantEmbeddingsDB is configured via a dictionary passed to its constructor (or via the OPM plugin config system when loaded by OVOS).

All configuration keys

KeyTypeDefaultDescription
vector_sizeintrequiredDimension of every vector stored in this DB. Must match the output dimension of your embedding model. All collections share this size.
distance_metricstr"cosine"Similarity function used for nearest-neighbour search. One of "cosine", "euclidean", "dot".
default_collection_namestr"embeddings"Name of the collection created automatically on startup. Used whenever collection_name is None.
hoststrnoneHostname of a remote Qdrant server. Setting this key activates remote client mode.
portint6333HTTP REST port for the remote client.
grpc_portint6334gRPC port for the remote client (used for high-throughput batch operations).
api_keystrnoneAuthentication key for Qdrant Cloud or a secured self-hosted instance.
pathstrnoneFilesystem directory for local persistent storage. Setting this key (without host) activates local client mode.

Client modes

The constructor inspects the config keys to decide which Qdrant client to create:

In-memory (development / CI)

Neither host nor path is present:

QdrantEmbeddingsDB(config={"vector_size": 384})

Data is lost when the object is garbage-collected. Ideal for tests and quick prototyping.

Local persistent

path is set, host is absent:

QdrantEmbeddingsDB(config={
    "path": "/var/lib/ovos/qdrant",
    "vector_size": 384,
})

Qdrant stores its WAL and segments under path. Survives restarts. No network required.

Remote

host is set:

QdrantEmbeddingsDB(config={
    "host": "qdrant.example.com",
    "port": 6333,
    "grpc_port": 6334,
    "api_key": "optional-secret",
    "vector_size": 384,
})

Connects over HTTP (REST) to the specified Qdrant server. Use api_key for Qdrant Cloud or any instance with authentication enabled.

Distance metrics

ValueQdrant enumBest for
"cosine"Distance.COSINESentence or word embeddings. Direction matters, magnitude does not.
"euclidean"Distance.EUCLIDDense float vectors where absolute distance matters.
"dot"Distance.DOTPre-normalized vectors. Equivalent to cosine, but faster.

Cosine normalization note

When distance_metric is "cosine", Qdrant normalizes every vector to unit length on upsert. Vectors retrieved through get_embeddings are unit-length, not the original floats. Nearest-neighbour query results are unaffected, because direction is preserved. Do not compare retrieved vectors to originals with np.allclose. Compare directions instead:

norm_v = v / np.linalg.norm(v)
norm_r = retrieved / np.linalg.norm(retrieved)
np.testing.assert_allclose(norm_v, norm_r, atol=1e-5)

Home · Usage →