pub struct ModelChatTemplate {
pub template: String,
pub source: String,
pub bos_token: Option<String>,
pub eos_token: Option<String>,
pub tool_call_protocol: ApiToolCallProtocol,
pub output_protocol: ModelOutputProtocol,
pub reasoning_protocol: ModelReasoningProtocol,
pub reasoning_default_enabled: bool,
pub reasoning_effort_support: ReasoningEffortSupport,
}Expand description
Model-provided chat template, usually from GGUF or Hugging Face metadata.
Fields§
§template: String§source: String§bos_token: Option<String>§eos_token: Option<String>§tool_call_protocol: ApiToolCallProtocol§output_protocol: ModelOutputProtocol§reasoning_protocol: ModelReasoningProtocol§reasoning_default_enabled: bool§reasoning_effort_support: ReasoningEffortSupportDeclared by the model implementation, independently of output parsing.
Implementations§
Source§impl ModelChatTemplate
impl ModelChatTemplate
pub fn new(template: impl Into<String>, source: impl Into<String>) -> Self
pub fn reasoning_enabled(&self, requested: Option<bool>) -> bool
Sourcepub fn reasoning_capability(&self) -> ModelReasoningProtocol
pub fn reasoning_capability(&self) -> ModelReasoningProtocol
The full output capability, including Harmony’s separate message parser. This observation does not change template rendering or reasoning defaults.
Sourcepub fn supports_thinking_control(&self) -> bool
pub fn supports_thinking_control(&self) -> bool
Observe an actual template switch. Reasoning output alone does not prove
that enable_thinking can disable it (an always-open template cannot).
Sourcepub fn set_output_protocol(&mut self, protocol: ModelOutputProtocol)
pub fn set_output_protocol(&mut self, protocol: ModelOutputProtocol)
Bind the resolved model capability after loading its unchanged template bytes, then probe reasoning with that protocol’s actual delimiters.
pub fn validate_reasoning_effort(&self, effort: ReasoningEffort) -> Result<()>
Trait Implementations§
Source§impl Clone for ModelChatTemplate
impl Clone for ModelChatTemplate
Source§fn clone(&self) -> ModelChatTemplate
fn clone(&self) -> ModelChatTemplate
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ModelChatTemplate
impl RefUnwindSafe for ModelChatTemplate
impl Send for ModelChatTemplate
impl Sync for ModelChatTemplate
impl Unpin for ModelChatTemplate
impl UnsafeUnpin for ModelChatTemplate
impl UnwindSafe for ModelChatTemplate
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