SDK API index
Complete index of the public Telys API — the Telys facade, every Collection method with its signature, scope_key, and the top-level exports.
Every symbol the telys package exports. The SDK is thin and pure-Python; the signed native runtime executes every collection operation and loads lazily on first use. Version 0.1.15, FORMAT_VERSION = 1, requires-python >=3.10.
from telys import Telys, Eq, scope_key, Tuner, TuningPlan, __version__, FORMAT_VERSIONTop-level exports
Import these directly from telys. Embedders, the remote client, the server, the runtime loader, and the verify API live in submodules (second table).
Telys
class
from telys import Telys
The engine facade.
scope_key
function
from telys import scope_key
Compose one partition key.
TuningPlan
dataclass
from telys import TuningPlan
Result of Collection.tune().
HeuristicTuner
class (lazy)
from telys import HeuristicTuner
In __all__, but resolves from the signed runtime — raises ImportError without it.
__version__
str
from telys import __version__
Installed distribution version.
FORMAT_VERSION
int
from telys import FORMAT_VERSION
On-disk format contract (1).
Not top-level (import from a submodule):
EmbeddingProvider, EmbeddingProfile, CallableEmbedder, AlgentaBigramEmbedder, AlgentaMultigramEmbedder, AlgentaPooledEmbedder
telys.embedding
The Telys facade
Constructor
Creates path as the engine-root directory; the runtime loads lazily on first use. Pass embedding_providers as a {key: provider} map to pre-register embedders, or add them later with register_provider.
Methods
register_provider(key, provider)
None
Register an embedder under a key so open_collection can re-attach it.
create_collection(name, dim, partition_by, embedder=None, dtype="f32", filter_columns=(), tuner=None, lexical=False)
Collection
Build and cache a collection. Does not write disk until col.save(). lexical=True retains code tokens for the BM25 index.
open_collection(name, embedder=None)
Collection
Open a saved collection; auto-attaches an embedder from the registry by model_id/space_id.
collections()
list[str]
Sorted names of directories containing a collection.json (i.e. already saved).
__getitem__(name)
Collection
ame[name] — return the cached collection or open it.
scope_key(*parts)
str
Join str(parts) with the \x1f separator into one partition key.
__version__ and FORMAT_VERSION are module-level (from telys import …), not attributes of the Telys class.
Collection
Returned by create_collection and open_collection. Every method requires the runtime; the *_texts variants also require an attached embedder (otherwise RuntimeError).
Ingest
All ingest methods return the list of external ids they wrote.
add_texts(texts, ids, metadata)
list
Embed and insert new rows only. KeyError if an id already exists; RuntimeError if no embedder.
add(vectors, ids, metadata)
list
Insert raw (n, dim) float32 vectors, new rows only.
upsert_texts(texts, ids, metadata)
list
Embed and insert-or-replace. Needs an embedder.
upsert(vectors, ids, metadata)
list
Insert-or-replace raw vectors.
update_texts(texts, ids, metadata)
list
Replace existing rows only. Needs an embedder.
Query
search(vector, top_k=10, where=None, explain=False, target_recall=None, with_metadata=False)
dict
Nearest neighbours by vector. Validates len(vector) == dim.
search_text(text, top_k=10, where=None, explain=False, target_recall=None, with_metadata=False, mode="dense")
dict
Embed text, then search. mode="lexical" runs on-device BM25 over code tokens instead (no embedder needed at query time; requires lexical=True + build_lexical).
ids(where=None)
list
Live external ids, optionally scoped by a single-key dict or Eq.
Both search variants return {"ids": [...], "scores": [...]}, plus "explain" when explain=True and "metadata" when with_metadata=True. where takes a single-key dict or an Eq instance.
Tuning
tune(workload=None, objectives=None, dry_run=None)
TuningPlan
Produce a plan. dry_run=True never applies; False always applies; None applies only when tuner.mode == "suggest_then_apply".
apply_tuning(plan)
stats
Set default_target_recall and exact-crossover, build/use per-partition IVF, set nprobe.
Maintenance
delete(ids)
Delete only the ids that are present.
compact()
Reclaim space from deleted and replaced rows.
build_ivf(min_rows=20000, target_recall=0.98)
Build the IVF index (skipped below min_rows).
build_lexical(k1=1.8, b=1.0)
Fit the on-device BM25 lexical index over retained code tokens (requires lexical=True; local-only). Query with search_text(mode="lexical").
snapshot()
Take an on-disk snapshot.
Persistence & introspection
stats()
dict
Runtime stats plus name, key_name, external_ids.
save()
dir
Commit to disk. Writes the id_map.npy sidecar, then collection.json last (the commit point).
save() persists: name, dim, dtype, key_name, filter_columns, id_map_sidecar, telys_version, default_target_recall, applied_tuner, lexical, and embedder_profile. When lexical=True, the retained code tokens persist too and the BM25 index is rebuilt from them on open.
Container protocol
len(col)
Number of external ids.
ext in col
Whether external id ext is live.
scope_key
Joins each str(part) with the \x1f (unit separator) into one partition key. Available top-level (from telys import scope_key) and as a method (ame.scope_key(...)). Use it because partition_by keys on one physical column.
Version & format constants
telys.__version__
"0.1.15"
Installed distribution version ("0.0.0+source" from a source checkout).
telys.FORMAT_VERSION
1
On-disk format contract for saved collections.
See also
Last updated
Was this helpful?