Skip to main content

DraftProvider

Trait DraftProvider 

Source
pub trait DraftProvider: Send + Sync {
    // Required methods
    fn draft<'life0, 'life1, 'async_trait>(
        &'life0 self,
        messages: &'life1 [ChatMessage],
        n_tokens: usize,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, DraftError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn model_name(&self) -> &str;
}
Expand description

Trait for a small/fast draft model that proposes candidate tokens.

The draft provider generates N candidate token strings given the current conversation context. These candidates are then verified by the target model.

Required Methods§

Source

fn draft<'life0, 'life1, 'async_trait>( &'life0 self, messages: &'life1 [ChatMessage], n_tokens: usize, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, DraftError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Generate n_tokens candidate continuations given the conversation so far.

Returns a Vec of token strings (one per draft position).

Source

fn model_name(&self) -> &str

Name of the draft model.

Implementors§