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

Create a collection

Create a Telys collection with a fixed dimension, a partition key, and an optional embedder, then commit it to disk with save().

A collection is Telys's unit of storage and search: records that share one vector dimension, one partition key, and an optional embedder. Telys.create_collection(...) builds the collection in memory and caches it on the facade; nothing touches disk until you call col.save().

Collection operations load the signed native runtime lazily, and the lexical embedders read their dimension from the native kernel. Without them, construction raises RuntimeNotInstalled / ImportError. Verify first with telys runtime verify — see Verify your install.

Signature

Telys.create_collection(
    name,
    dim,
    partition_by,
    embedder=None,
    dtype="f32",
    filter_columns=(),
    tuner=None,
    lexical=False,
) -> Collection
Parameter
Type
Default
Meaning

name

str

—

Collection name; also the on-disk subdirectory under the store path.

dim

int

—

Vector dimension. Must equal your embedder's profile.dimension (or the width of the vectors you will add).

partition_by

str

—

Metadata column used as the physical partition key. A list/tuple uses only element [0] — see the note below.

embedder

EmbeddingProvider | None

None

Attaches an embedder so add_texts / search_text work. Omit for a vectors-only collection.

dtype

str

"f32"

On-disk vector storage dtype (single-precision float by default).

filter_columns

tuple[str, ...]

()

Extra metadata columns you may constrain with Eq / where.

tuner

Tuner | None

None

Optional tuner for index tuning (see Why tune).

lexical

bool

False

Retain code tokens at ingest so you can build_lexical and query search_text(mode="lexical") (on-device BM25).

Create a text-backed collection

Construct an embedder and pass its profile.dimension as dim so the collection width always matches the vectors the embedder produces.

1

Open a store

Telys(path) creates the directory if needed and prepares the lazy runtime. The path holds every collection in this store.

2

Pick an embedder and read its dimension

Import embedders from telys.embedding, not the top level. AlgentaMultigramEmbedder is lexical; its width comes from the native kernel, so read it from the profile rather than hard-coding a number.

3

Create the collection

memories is a Collection you can query and mutate immediately, but it stays in memory until you save.

4

Commit it to disk

save() writes the id_map.npy sidecar, then collection.json (the commit point), and returns the directory it wrote.

Add dtype and filter columns

filter_columns declares which metadata columns you can later constrain with Eq. The partition key is always filterable; any other column must be listed here at creation time.

Records can now be filtered on tenant_id, lang, or source. See Filter results.

Expected result

create_collection returns a Collection with zero records. telys.collections() lists only saved collections, so it stays empty until save():

To reopen a saved collection later, call telys.open_collection("memories", embedder=...), or register the embedder once with telys.register_provider(...) so open_collection re-attaches it automatically.

Next steps

Last updated

Was this helpful?