Skip to main content

Module embed

Module embed 

Source
Expand description

Which embedding model a store uses, and how to load it.

fastembed ships an enum of models it knows how to fetch and configure. The default is not in that enum: granite-embedding-small-english-r2, quantized to int8, has to be assembled by hand from its ONNX graph, its separate weights file, and its tokenizer. Model is the union of “something fastembed knows” and “the one we assemble ourselves”, so a store can record either and read it back.

Enums§

Model
A model a store can be built with.

Constants§

AIRGAP_ENV
How many threads ONNX Runtime should use inside one operator.
GRANITE_FILES
Every file semlith fetches from [GRANITE_REPO], with its SHA-256.
GRANITE_NAME
What a store writes into its model meta row for granite. Changing this string orphans every store that recorded the old one.
GRANITE_REVISION
The commit each model repository is fetched at.
THREADS_ENV
Cap on ONNX Runtime’s intra-op thread pool, overriding the derived value.

Functions§

airgap
check_cache_dir
Refuse a model cache that somebody else on this machine can write to.
digest
The SHA-256 of some bytes, as lowercase hex.
embed_threads
is_cached
Whether the default model is cached, with the right bytes.
link_runtime
Point ONNX Runtime at the library shipped beside this binary.
model_is_cached
Whether one model’s weights are already in the cache.
refuse_if_airgapped
Whether the cache already holds something to load.
verify
Check bytes against the digest recorded for them, or say which file failed.
verify_cached
Verify every pinned file of a repository that fastembed fetched itself.