pub trait TokenGeneratorTrait: Send {
// Required methods
fn init(&mut self, prompt_tokens: Vec<u32>) -> Result<()>;
fn next(&mut self) -> Result<TokenGeneratorResult>;
}
Expand description
A trait defining the behavior of a token generator.
This trait is implemented by objects that can generate tokens based on some internal logic. The trait provides methods to initialize the generator and to retrieve the next token in the sequence.
Required Methods§
sourcefn next(&mut self) -> Result<TokenGeneratorResult>
fn next(&mut self) -> Result<TokenGeneratorResult>
Retrieves the next token from the generator.
Returns
A Result
containing the TokenGeneratorResult
, which can be either a token or a signal to finish generation.