Skip to main content

LocalSpec

Struct LocalSpec 

Source
#[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

Source

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.

Source

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.

Source

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.

Source

pub fn with_class(self, class: DeviceClass) -> Self

Sets the device class. pick only returns rows of the asked class. Default Desktop.

Source

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.

Source

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.

Marks the row as the recommended one for its class. LocalCatalog::new allows at most one per class. Default false.

Source

pub fn id(&self) -> &str

Returns the model id, also its cache file name stem. Input: none. Output: the id.

Source

pub fn url(&self) -> &str

Returns the https download URL. Input: none. Output: the URL.

Source

pub fn sha256(&self) -> &str

Returns the expected SHA-256 in lowercase hex. Input: none. Output: 64 hex characters.

Source

pub fn bytes(&self) -> u64

Returns the exact file size in bytes. Input: none. Output: above 0.

Source

pub fn ram_bytes(&self) -> u64

Returns the resident memory estimate in bytes. Input: none. Default the file size.

Source

pub fn context(&self) -> usize

Returns the intended context length. Input: none. Default 4 096.

Source

pub fn class(&self) -> DeviceClass

Returns the device class. Input: none. Default Desktop.

Source

pub fn licence(&self) -> &str

Returns the licence name. Input: none. Default empty.

Source

pub fn embeddings(&self) -> bool

Returns whether the model can embed. Input: none. Default false.

Source

pub fn recommended(&self) -> bool

Returns whether the row is recommended for its class. Input: none. Default false.

Trait Implementations§

Source§

impl Clone for LocalSpec

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for LocalSpec

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for LocalSpec

Source§

impl PartialEq for LocalSpec

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for LocalSpec

Auto Trait Implementations§

§

impl Forget for LocalSpec

§

impl Freeze for LocalSpec
where *const u8 is !null: Freeze, PhantomData<u8>: Freeze,

§

impl Move for LocalSpec

§

impl RefUnwindSafe for LocalSpec

§

impl Send for LocalSpec
where RawVecInner: Send,

§

impl Sync for LocalSpec
where RawVecInner: Sync,

§

impl Unpin for LocalSpec
where *const u8 is !null: Unpin,

§

impl UnsafeUnpin for LocalSpec

§

impl UnwindSafe for LocalSpec
where RawVecInner: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.