pub trait ModelBuilder {
type Model;
type Error: Send + Sync + 'static;
// Required method
fn start_with_loading_handler(
self,
handler: impl FnMut(ModelLoadingProgress) + Send + Sync + 'static,
) -> impl Future<Output = Result<Self::Model, Self::Error>>
where Self: Sized;
// Provided methods
fn start(self) -> impl Future<Output = Result<Self::Model, Self::Error>>
where Self: Sized { ... }
fn requires_download(&self) -> bool { ... }
}Expand description
A builder that can create a model asynchronously.
§Example
use kalosm::language::*;
#[tokio::main]
async fn main() {
let model = Llama::builder().start().await.unwrap();
}Required Associated Types§
Required Methods§
Provided Methods§
Sourcefn start(self) -> impl Future<Output = Result<Self::Model, Self::Error>>where
Self: Sized,
fn start(self) -> impl Future<Output = Result<Self::Model, Self::Error>>where
Self: Sized,
Start the model.
Sourcefn requires_download(&self) -> bool
fn requires_download(&self) -> bool
Check if the model will need to be downloaded before use (default: false)