#[non_exhaustive]pub struct LocalSpec { /* private fields */ }Expand description
One downloadable model: id, https URL, SHA-256, size in bytes,
resident RAM estimate, context, device class, licence, embedding
support and the recommended flag. Checked by new; with_* setters.
Implementations§
Source§impl LocalSpec
impl LocalSpec
Sourcepub fn new(
id: &str,
url: &str,
sha256: &str,
bytes: u64,
) -> Result<Self, LocalError>
pub fn new( id: &str, url: &str, sha256: &str, bytes: u64, ) -> Result<Self, LocalError>
Checks and builds a row. Rules: id of lowercase letters, digits,
-, _, . (1 to 64 bytes, no leading dot); https:// URL; 64
lowercase hex chars; size above 0. Output: the row, or Catalog.
Sourcepub fn with_ram_bytes(self, ram_bytes: u64) -> Self
pub fn with_ram_bytes(self, ram_bytes: u64) -> Self
Sets the resident memory estimate at the default context.
pick compares it with the app’s RAM budget.
Default the file size.
Sourcepub fn with_context(self, context: usize) -> Self
pub fn with_context(self, context: usize) -> Self
Sets the context length the row is meant to run with.
Informational; LlamaSettings sets the real one.
Default 4 096.
Sourcepub fn with_class(self, class: DeviceClass) -> Self
pub fn with_class(self, class: DeviceClass) -> Self
Sets the device class.
pick only returns rows of the asked class.
Default Desktop.
Sourcepub fn with_licence(self, licence: impl Into<String>) -> Self
pub fn with_licence(self, licence: impl Into<String>) -> Self
Sets the licence name, such as apache-2.0.
The owner confirms licences before a release.
Default empty.
Sourcepub fn with_embeddings(self, embeddings: bool) -> Self
pub fn with_embeddings(self, embeddings: bool) -> Self
Marks the model as able to embed.
Load it with LlamaSettings::with_embeddings(true) to use it.
Default false.
Sourcepub fn with_recommended(self, recommended: bool) -> Self
pub fn with_recommended(self, recommended: bool) -> Self
Marks the row as the recommended one for its class.
LocalCatalog::new allows at most one per class.
Default false.
Sourcepub fn id(&self) -> &str
pub fn id(&self) -> &str
Returns the model id, also its cache file name stem. Input: none. Output: the id.
Sourcepub fn sha256(&self) -> &str
pub fn sha256(&self) -> &str
Returns the expected SHA-256 in lowercase hex. Input: none. Output: 64 hex characters.
Sourcepub fn ram_bytes(&self) -> u64
pub fn ram_bytes(&self) -> u64
Returns the resident memory estimate in bytes. Input: none. Default the file size.
Sourcepub fn context(&self) -> usize
pub fn context(&self) -> usize
Returns the intended context length. Input: none. Default 4 096.
Sourcepub fn class(&self) -> DeviceClass
pub fn class(&self) -> DeviceClass
Returns the device class.
Input: none.
Default Desktop.
Sourcepub fn embeddings(&self) -> bool
pub fn embeddings(&self) -> bool
Returns whether the model can embed. Input: none. Default false.
Sourcepub fn recommended(&self) -> bool
pub fn recommended(&self) -> bool
Returns whether the row is recommended for its class. Input: none. Default false.
Trait Implementations§
impl Eq for LocalSpec
impl StructuralPartialEq for LocalSpec
Auto Trait Implementations§
impl Forget for LocalSpec
impl Freeze for LocalSpec
impl Move for LocalSpec
impl RefUnwindSafe for LocalSpec
impl Send for LocalSpecwhere
RawVecInner: Send,
impl Sync for LocalSpecwhere
RawVecInner: Sync,
impl Unpin for LocalSpec
impl UnsafeUnpin for LocalSpec
impl UnwindSafe for LocalSpecwhere
RawVecInner: UnwindSafe,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.