pub struct ChatTemplate { /* private fields */ }Expand description
Renders a conversation to a tokenizable string using the model’s
Jinja2 chat template (from tokenizer_config.json).
Implementations§
Source§impl ChatTemplate
impl ChatTemplate
Sourcepub fn from_tokenizer_config(path: &Path) -> Result<Self>
pub fn from_tokenizer_config(path: &Path) -> Result<Self>
Load from a tokenizer_config.json file.
Sourcepub fn from_template(template: impl Into<String>) -> Self
pub fn from_template(template: impl Into<String>) -> Self
Build with a raw Jinja2 template string.
Auto Trait Implementations§
impl Freeze for ChatTemplate
impl RefUnwindSafe for ChatTemplate
impl Send for ChatTemplate
impl Sync for ChatTemplate
impl Unpin for ChatTemplate
impl UnsafeUnpin for ChatTemplate
impl UnwindSafe for ChatTemplate
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
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