pub struct ModelManager { /* private fields */ }Expand description
Downloads, verifies and loads models. Every artifact is pinned by commit and SHA256; nothing is fetched implicitly during search.
Implementations§
Source§impl ModelManager
impl ModelManager
pub fn new() -> Self
pub fn with_cache_dir(cache_dir: PathBuf) -> Self
pub fn cache_dir(&self) -> &Path
pub fn specs(&self) -> &[ModelSpec]
pub fn spec(&self, model_id: &str) -> Result<&ModelSpec>
pub fn model_dir(&self, model_id: &str) -> PathBuf
pub fn file_path(&self, model_id: &str, file: &str) -> PathBuf
Sourcepub fn is_installed(&self, model_id: &str) -> bool
pub fn is_installed(&self, model_id: &str) -> bool
True when every artifact is present and matches its pinned hash. Results are cached so repeated calls don’t re-hash multi-GB files (I1).
Sourcepub async fn ensure(&self, model_id: &str) -> Result<PathBuf>
pub async fn ensure(&self, model_id: &str) -> Result<PathBuf>
Ensure every file of model_id is present and verified, downloading what
is missing or corrupt. Returns the model directory.
pub fn list(&self) -> Vec<ModelInfo>
pub fn load_embedder(&self, model_id: &str) -> Result<Embedder>
Sourcepub fn embedder_if_installed(&self, model_id: &str) -> Option<Embedder>
pub fn embedder_if_installed(&self, model_id: &str) -> Option<Embedder>
Load the default embedder if (and only if) it is already on disk.
pub fn load_reranker(&self) -> Result<Reranker>
pub fn reranker_if_installed(&self) -> Option<Reranker>
pub async fn remove(&self, model_id: &str) -> Result<()>
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for ModelManager
impl !RefUnwindSafe for ModelManager
impl !UnwindSafe for ModelManager
impl Forget for ModelManager
impl Move for ModelManager
impl Send for ModelManager
impl Sync for ModelManager
impl Unpin for ModelManager
impl UnsafeUnpin for ModelManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more