pub struct LlamaLoraAdapter { /* private fields */ }Expand description
A safe wrapper around llama_adapter_lora.
Implementations§
Source§impl LlamaLoraAdapter
impl LlamaLoraAdapter
Sourcepub fn meta_count(&self) -> i32
pub fn meta_count(&self) -> i32
Get the number of metadata key-value pairs in the adapter.
Sourcepub fn meta_key_by_index(
&self,
index: i32,
buf_size: usize,
) -> Result<String, StringFromModelError>
pub fn meta_key_by_index( &self, index: i32, buf_size: usize, ) -> Result<String, StringFromModelError>
Get a metadata key by index.
§Errors
Returns an error if the index is out of range or the key is not valid UTF-8.
Sourcepub fn meta_val_str(
&self,
key: &str,
buf_size: usize,
) -> Result<String, StringFromModelError>
pub fn meta_val_str( &self, key: &str, buf_size: usize, ) -> Result<String, StringFromModelError>
Get a metadata value by key name.
§Errors
Returns an error if the key is not found or the value is not valid UTF-8.
Sourcepub fn meta_val_str_by_index(
&self,
index: i32,
buf_size: usize,
) -> Result<String, StringFromModelError>
pub fn meta_val_str_by_index( &self, index: i32, buf_size: usize, ) -> Result<String, StringFromModelError>
Get a metadata value by index.
§Errors
Returns an error if the index is out of range or the value is not valid UTF-8.
Sourcepub fn metadata(&self) -> Result<Vec<(String, String)>, StringFromModelError>
pub fn metadata(&self) -> Result<Vec<(String, String)>, StringFromModelError>
Get all metadata as a list of (key, value) pairs.
§Errors
Returns an error if any key or value cannot be read or is not valid UTF-8.
Sourcepub fn n_invocation_tokens(&self) -> u64
pub fn n_invocation_tokens(&self) -> u64
Get the number of invocation tokens for this adapter.
Sourcepub fn invocation_tokens(&self) -> &[LlamaToken]
pub fn invocation_tokens(&self) -> &[LlamaToken]
Get the invocation tokens for this adapter.
Returns an empty slice if there are no invocation tokens.
Trait Implementations§
Source§impl Debug for LlamaLoraAdapter
impl Debug for LlamaLoraAdapter
Auto Trait Implementations§
impl Freeze for LlamaLoraAdapter
impl RefUnwindSafe for LlamaLoraAdapter
impl !Send for LlamaLoraAdapter
impl !Sync for LlamaLoraAdapter
impl Unpin for LlamaLoraAdapter
impl UnsafeUnpin for LlamaLoraAdapter
impl UnwindSafe for LlamaLoraAdapter
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