Skip to main content

TextSamplingControlBackend

Trait TextSamplingControlBackend 

Source
pub trait TextSamplingControlBackend: TextGenerationBackend {
    // Required methods
    fn sampling_control_facts(
        state: &Self::TextGenerationState,
    ) -> SamplingStateFacts;
    fn install_sampling_override(
        runtime: &mut ModelRuntime<Self>,
        state: &mut Self::TextGenerationState,
        request: ValidatedSamplingOverride,
    ) -> Result<(), Self::Error>;
}
Expand description

Minimal native mechanism; ordinary sampling and snapshot state keep their existing owners. Errors must preserve the previous logical sampling state.

Required Methods§

Source

fn sampling_control_facts( state: &Self::TextGenerationState, ) -> SamplingStateFacts

Side-effect-free facts for the installed sampling state.

Source

fn install_sampling_override( runtime: &mut ModelRuntime<Self>, state: &mut Self::TextGenerationState, request: ValidatedSamplingOverride, ) -> Result<(), Self::Error>

Prepares any replacement key and proves completion through the existing recovery owner before installing temperature/key together. Consumes no RNG draw, submits no model prediction and leaves all sampler history intact.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§