pub struct TokenChoiceController<C> { /* private fields */ }Expand description
Adds a one-decision restriction to an existing canonical constraint owner. Native sampling, penalties, history and RNG still use the ordinary path. A forced decision consumes exactly that sampler’s one-candidate decision: at nonzero temperature RNG advances as usual, and Mirostat observes probability one. It does not edit an already committed prefix or replay text.
Implementations§
Source§impl<C: TokenFilterController> TokenChoiceController<C>
impl<C: TokenFilterController> TokenChoiceController<C>
Sourcepub fn new(inner: C, domain: TokenDomain) -> Self
pub fn new(inner: C, domain: TokenDomain) -> Self
Wraps the existing grammar with the canonical tokenizer vocabulary domain.
Sourcepub fn force_next(
&mut self,
token: u32,
) -> Result<(), TokenChoiceError<C::Error>>
pub fn force_next( &mut self, token: u32, ) -> Result<(), TokenChoiceError<C::Error>>
Stages a choice after checking vocabulary and the current active grammar. No token is committed and no sampler/RNG or model state advances here.
Sourcepub fn clear_forced(&mut self) -> bool
pub fn clear_forced(&mut self) -> bool
Removes an uncommitted choice without changing history or randomness.
Sourcepub fn pending_forced(&self) -> Option<u32>
pub fn pending_forced(&self) -> Option<u32>
Choice still waiting for the next ordinary commitment.
Sourcepub fn last_committed_was_forced(&self) -> bool
pub fn last_committed_was_forced(&self) -> bool
Whether the most recent canonical commitment consumed a forced choice.
Trait Implementations§
Source§impl<C: Clone> Clone for TokenChoiceController<C>
impl<C: Clone> Clone for TokenChoiceController<C>
Source§fn clone(&self) -> TokenChoiceController<C>
fn clone(&self) -> TokenChoiceController<C>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more