Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Embedding profiles

Reference for EmbeddingProfile — the frozen record that names a vector space and, via space_id(), gates which embedder can reopen or attach to a collection.

An EmbeddingProfile is the identity card of a vector space. Every embedder carries one, every saved collection stores one, and Telys uses its space_id() to decide whether an embedder may attach to a collection. Vectors from two different spaces are never comparable, so this record keeps a collection honest across reopen and re-attach.

from telys.embedding import EmbeddingProfile

Signature

EmbeddingProfile(
    provider,
    model_id,
    model_version,
    dimension,
    dtype="float32",
    normalization="l2",
    distance="ip",
    pooling="none",
    tokenizer_hash="",
    projection_version="",
    created="",
)

A frozen dataclass — instances are immutable. Construct a new one to describe a new space.

Fields

Field
Type
Default
Purpose

provider

str

(required)

Who produces the vectors, e.g. "openai", "algenta", "local".

model_id

str

(required)

Model name, e.g. "text-embedding-3-small", "bigram".

model_version

str

(required)

Version tag; bump it when the model's weights or behavior change.

dimension

int

(required)

Vector width D. Must equal the collection dim and what the embedder returns.

dtype

str

"float32"

Element type of the emitted vectors.

normalization

str

"l2"

Norm your vectors carry ("l2" = unit length, "none" = raw).

distance

str

"ip"

Similarity used at search time ("ip" = inner product; equals cosine on L2-normalized vectors).

pooling

str

"none"

How tokens are pooled, e.g. "bigram-hash", "multigram-hash", "none".

tokenizer_hash

str

""

Optional tokenizer digest, for models where tokenization defines the space.

projection_version

str

""

Optional tag for a post-embedding projection/reduction.

created

str

""

Provenance timestamp. Bookkeeping only — see below.

Methods

Method
Returns
Description

space_id()

str

"sha256:" plus 16 hex characters — a stable digest of the space-defining fields.

compatible_with(other)

bool

True when self.space_id() == other.space_id().

as_dict()

dict

The field values. A saved collection stores this as embedder_profile.

What defines space identity

space_id() digests the fields that determine whether vectors are comparable — provider/model identity, dimension, dtype, normalization, distance, pooling, and the tokenizer/projection tags. Change any of them and you have declared a new space:

Because created stays out of the digest, a collection saved yesterday still matches a freshly built provider you register today — reopen keeps working across time.

How identity gates reopen and attach

The profile is the contract enforced when an embedder meets a collection:

1

Create

create_collection(..., embedder=e) records e.profile and requires dim == e.profile.dimension.

2

Save

col.save() persists embedder_profile (the as_dict() form) into collection.json.

3

Reopen

open_collection(name) auto-attaches an embedder from the provider registry by matching model_id and space_id(). A provider whose space_id() differs will not attach — register one that describes the same space.

To reopen a collection built with a custom embedder, register a matching provider first: ame.register_provider(my_embedder.profile.model_id, my_embedder) before open_collection. The registration key must equal the stored profile's model_id (or its space_id()) — auto-attach looks up by model_id, then space_id(). An arbitrary label will not match.

Inspect a stored profile

See also

Last updated

Was this helpful?