pub struct MistralTemplate { /* private fields */ }Expand description
Mistral Template (Mistral, Mixtral)
Format: <s>[INST] {user} [/INST] (no system prompt support)
§Example
use aprender::text::chat_template::{ChatMessage, MistralTemplate, ChatTemplateEngine};
let template = MistralTemplate::new();
assert!(!template.supports_system_prompt());Implementations§
Trait Implementations§
Source§impl ChatTemplateEngine for MistralTemplate
impl ChatTemplateEngine for MistralTemplate
Source§fn format_message(
&self,
role: &str,
content: &str,
) -> Result<String, AprenderError>
fn format_message( &self, role: &str, content: &str, ) -> Result<String, AprenderError>
Format a single message with role and content (for streaming/partial)
Source§fn format_conversation(
&self,
messages: &[ChatMessage],
) -> Result<String, AprenderError>
fn format_conversation( &self, messages: &[ChatMessage], ) -> Result<String, AprenderError>
Format a complete conversation
Source§fn special_tokens(&self) -> &SpecialTokens
fn special_tokens(&self) -> &SpecialTokens
Get special tokens for this template
Source§fn format(&self) -> TemplateFormat
fn format(&self) -> TemplateFormat
Get the detected template format
Source§fn supports_system_prompt(&self) -> bool
fn supports_system_prompt(&self) -> bool
Check if this template supports system prompts
Source§impl Clone for MistralTemplate
impl Clone for MistralTemplate
Source§fn clone(&self) -> MistralTemplate
fn clone(&self) -> MistralTemplate
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 MistralTemplate
impl Debug for MistralTemplate
Auto Trait Implementations§
impl Freeze for MistralTemplate
impl RefUnwindSafe for MistralTemplate
impl Send for MistralTemplate
impl Sync for MistralTemplate
impl Unpin for MistralTemplate
impl UnsafeUnpin for MistralTemplate
impl UnwindSafe for MistralTemplate
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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