pub enum GrammarSource {
None,
User,
OutputFormat,
ToolCalls,
}Expand description
How a grammar was obtained, which decides whether the generation prompt is prefilled into it.
Getting this wrong is silent: prefilling a user grammar consumes tokens it never expected, and not prefilling a tool-call grammar forces the model to re-emit the generation prompt.
Variants§
None
No grammar.
User
Supplied verbatim by the caller. Never prefilled.
OutputFormat
Generated from a JSON schema. Prefilled.
ToolCalls
Generated by a chat template for tool calling. Prefilled.
Trait Implementations§
Source§impl Clone for GrammarSource
impl Clone for GrammarSource
Source§fn clone(&self) -> GrammarSource
fn clone(&self) -> GrammarSource
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 moreimpl Copy for GrammarSource
Source§impl Debug for GrammarSource
impl Debug for GrammarSource
Source§impl Default for GrammarSource
impl Default for GrammarSource
Source§fn default() -> GrammarSource
fn default() -> GrammarSource
Returns the “default value” for a type. Read more
impl Eq for GrammarSource
Source§impl PartialEq for GrammarSource
impl PartialEq for GrammarSource
impl StructuralPartialEq for GrammarSource
Auto Trait Implementations§
impl Freeze for GrammarSource
impl RefUnwindSafe for GrammarSource
impl Send for GrammarSource
impl Sync for GrammarSource
impl Unpin for GrammarSource
impl UnsafeUnpin for GrammarSource
impl UnwindSafe for GrammarSource
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