pub struct LlamaChatTemplate(/* private fields */);
Expand description
A performance-friendly wrapper around LlamaModel::chat_template which is then fed into LlamaModel::apply_chat_template to convert a list of messages into an LLM prompt. Internally the template is stored as a CString to avoid round-trip conversions within the FFI.
Implementations§
Source§impl LlamaChatTemplate
impl LlamaChatTemplate
Sourcepub fn new(template: &str) -> Result<Self, NulError>
pub fn new(template: &str) -> Result<Self, NulError>
Create a new template from a string. This can either be the name of a llama.cpp chat template like “chatml” or “llama3” or an actual Jinja template for llama.cpp to interpret.
Trait Implementations§
Source§impl Clone for LlamaChatTemplate
impl Clone for LlamaChatTemplate
Source§fn clone(&self) -> LlamaChatTemplate
fn clone(&self) -> LlamaChatTemplate
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for LlamaChatTemplate
impl Debug for LlamaChatTemplate
Source§impl Hash for LlamaChatTemplate
impl Hash for LlamaChatTemplate
Source§impl Ord for LlamaChatTemplate
impl Ord for LlamaChatTemplate
Source§fn cmp(&self, other: &LlamaChatTemplate) -> Ordering
fn cmp(&self, other: &LlamaChatTemplate) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for LlamaChatTemplate
impl PartialEq for LlamaChatTemplate
Source§impl PartialOrd for LlamaChatTemplate
impl PartialOrd for LlamaChatTemplate
impl Eq for LlamaChatTemplate
impl StructuralPartialEq for LlamaChatTemplate
Auto Trait Implementations§
impl Freeze for LlamaChatTemplate
impl RefUnwindSafe for LlamaChatTemplate
impl Send for LlamaChatTemplate
impl Sync for LlamaChatTemplate
impl Unpin for LlamaChatTemplate
impl UnwindSafe for LlamaChatTemplate
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