pub struct SemanticModel {}Expand description
Wrapper around an ONNX Runtime session for the embedding model.
Implementations§
Source§impl SemanticModel
impl SemanticModel
Sourcepub fn load() -> Result<Self>
pub fn load() -> Result<Self>
Load the model from the OS cache directory.
If the cache file is missing or has a mismatched SHA256, this extracts bundled model bytes into the cache directory before creating an ORT session. When no bundled bytes are available, this attempts a one-time download of model/tokenizer assets from stable URLs.
§Errors
Returns an error if the model cannot be loaded or the cache is invalid.
Sourcepub fn model_cache_path() -> Result<PathBuf>
pub fn model_cache_path() -> Result<PathBuf>
Return the OS-appropriate cache path for the model file.
Uses dirs::cache_dir() / bones / models / minilm-l6-v2-int8.onnx.
§Errors
Returns an error if the OS cache directory cannot be determined.
Sourcepub fn is_cached_valid(path: &Path) -> bool
pub fn is_cached_valid(path: &Path) -> bool
Check if cached model matches expected SHA256.
Sourcepub fn extract_to_cache(path: &Path) -> Result<()>
pub fn extract_to_cache(path: &Path) -> Result<()>
Extract bundled model bytes to cache directory.
§Errors
Returns an error if no bundled bytes are available, or if the file system operations fail, or if the extracted model fails SHA256 verification.