pub trait TextGenerator: Generator {
// Required methods
fn add_message(&mut self, message: Message) -> Result<()>;
fn reset(&mut self) -> Result<()>;
fn goodbye<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn next_token<'life0, 'async_trait>(
&'life0 mut self,
index: usize,
) -> Pin<Box<dyn Future<Output = Result<Token>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn generated_tokens(&self) -> usize;
}Required Methods§
Sourcefn add_message(&mut self, message: Message) -> Result<()>
fn add_message(&mut self, message: Message) -> Result<()>
Add a message to the chat.
Sourcefn goodbye<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn goodbye<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
clear worker kv cache
Sourcefn next_token<'life0, 'async_trait>(
&'life0 mut self,
index: usize,
) -> Pin<Box<dyn Future<Output = Result<Token>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn next_token<'life0, 'async_trait>(
&'life0 mut self,
index: usize,
) -> Pin<Box<dyn Future<Output = Result<Token>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Return the next token.
Sourcefn generated_tokens(&self) -> usize
fn generated_tokens(&self) -> usize
Return the number of generated tokens so far.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.