pub struct ModelRegistry { /* private fields */ }Expand description
Thread-safe registry of loaded model metadata.
Models are keyed by name; each registration parses (or accepts) GGUF metadata without loading tensor weights.
§Example
use oxirs_graphrag::model_loader::{ModelRegistry, GgufMetadata, GgufParser};
use std::path::PathBuf;
let registry = ModelRegistry::new();
// In real usage you would supply a path to a .gguf file:
// let handle = registry.register("llama-3-8b", PathBuf::from("model.gguf")).unwrap();
assert!(registry.is_empty());Implementations§
Source§impl ModelRegistry
impl ModelRegistry
Sourcepub fn register(
&self,
name: &str,
path: PathBuf,
) -> Result<ModelHandle, RegistryError>
pub fn register( &self, name: &str, path: PathBuf, ) -> Result<ModelHandle, RegistryError>
Register a model by parsing its GGUF file.
Returns an error if name is already registered or the file cannot be
parsed.
Sourcepub fn register_with_metadata(
&self,
name: &str,
path: PathBuf,
metadata: GgufMetadata,
) -> Result<ModelHandle, RegistryError>
pub fn register_with_metadata( &self, name: &str, path: PathBuf, metadata: GgufMetadata, ) -> Result<ModelHandle, RegistryError>
Register a model with pre-parsed metadata.
Useful for tests that construct synthetic metadata without a real file.
Sourcepub fn get(&self, handle: &ModelHandle) -> Option<ModelInfo>
pub fn get(&self, handle: &ModelHandle) -> Option<ModelInfo>
Look up a model by its handle.
Sourcepub fn get_by_name(&self, name: &str) -> Option<ModelInfo>
pub fn get_by_name(&self, name: &str) -> Option<ModelInfo>
Look up a model by name.
Sourcepub fn list(&self) -> Vec<ModelHandle>
pub fn list(&self) -> Vec<ModelHandle>
List all registered model handles.
Sourcepub fn remove(&self, handle: &ModelHandle) -> bool
pub fn remove(&self, handle: &ModelHandle) -> bool
Remove a model from the registry.
Returns true if the model existed and was removed.
Trait Implementations§
Source§impl Default for ModelRegistry
impl Default for ModelRegistry
Source§fn default() -> ModelRegistry
fn default() -> ModelRegistry
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !Freeze for ModelRegistry
impl RefUnwindSafe for ModelRegistry
impl Send for ModelRegistry
impl Sync for ModelRegistry
impl Unpin for ModelRegistry
impl UnsafeUnpin for ModelRegistry
impl UnwindSafe for ModelRegistry
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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