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

Bigram embedder

Reference for AlgentaBigramEmbedder — the compact on-device lexical bigram-hash embedder in telys.embedding.

A compact, on-device lexical embedder. It hashes character bigrams of each input into a fixed-width float32 vector, L2-normalized so inner-product search behaves like cosine similarity. It runs entirely inside the native kernel — no model download, no network — and is the smallest shipped space, which suits short strings such as keys, tags, and symbol names.

from telys.embedding import AlgentaBigramEmbedder

emb = AlgentaBigramEmbedder(max_bytes=1 << 20)

Signature

AlgentaBigramEmbedder(*, max_bytes: int = 1 << 20)

Keyword-only. Takes no dimension, model_id, or space_id argument — space identity comes from the profile, and the dimension is read from the native kernel at construction time.

Parameter
Type
Default
Meaning

max_bytes

int

1 << 20 (1 MiB)

Upper bound on the UTF-8 bytes read per input string. Longer inputs are truncated before hashing.

Requirements

Interface

AlgentaBigramEmbedder satisfies the EmbeddingProvider protocol:

Member
Returns
Notes

profile

EmbeddingProfile

The frozen space descriptor (see below).

embed_documents(texts)

ndarray[N, D] float32

Embeds documents for ingestion.

embed_queries(texts)

ndarray[N, D] float32

Embeds queries; defaults to embed_documents.

emb = AlgentaBigramEmbedder()

emb.profile.dimension            # e.g. 64 — read from the native kernel
vecs = emb.embed_documents(["hello world", "telys memory"])
vecs.shape                       # (2, D)   float32, L2-normalized rows

Profile

The embedder exposes a frozen EmbeddingProfile with fixed identity fields:

Field
Value

provider

"algenta"

model_id

"bigram"

dimension

read from the native kernel (hint: 64)

dtype

"float32"

normalization

"l2"

distance

"ip" (inner product; with L2 rows this equals cosine)

pooling

"bigram-hash"

model_version ("0.1.15") and tokenizer_hash ("utf8-bytes") are fixed constants; projection_version and created default to empty strings. Only dimension is read from the kernel. Inspect the exact values for your install:

Two embedders address the same collection only when their space_id() values match — see compatible_with.

Using it with a collection

Create the collection with the embedder's own dimension, never a hard-coded kernel hint:

See also

Last updated

Was this helpful?