pub struct AiRuntime { /* private fields */ }Expand description
The assembled AI subsystem.
Implementations§
Source§impl AiRuntime
impl AiRuntime
Sourcepub fn new(
registry: ModelRegistry,
providers: impl IntoIterator<Item = (String, Arc<dyn InferenceProvider>)>,
local_provider: Option<Arc<dyn InferenceProvider>>,
cache: Arc<AiResultCache>,
call_log: Arc<AiCallLog>,
) -> Self
pub fn new( registry: ModelRegistry, providers: impl IntoIterator<Item = (String, Arc<dyn InferenceProvider>)>, local_provider: Option<Arc<dyn InferenceProvider>>, cache: Arc<AiResultCache>, call_log: Arc<AiCallLog>, ) -> Self
Assemble a runtime. providers is keyed by provider name (matching a
model’s provider); local_provider, when present, serves every local
model. Each registered model is assigned a stable cache id.
Sourcepub fn registry(&self) -> &ModelRegistry
pub fn registry(&self) -> &ModelRegistry
The model registry (backs laminar.models and plan-time validation).
Sourcepub fn cache(&self) -> &Arc<AiResultCache>
pub fn cache(&self) -> &Arc<AiResultCache>
The shared result cache.
Sourcepub fn resolve(&self, model_name: &str) -> Result<ResolvedModel, AiRuntimeError>
pub fn resolve(&self, model_name: &str) -> Result<ResolvedModel, AiRuntimeError>
Resolve a model name to a runnable backend.
§Errors
Returns AiRuntimeError if the model is unknown, names an unconfigured
provider, or is local while the local backend is unavailable.
Auto Trait Implementations§
impl Freeze for AiRuntime
impl !RefUnwindSafe for AiRuntime
impl Send for AiRuntime
impl Sync for AiRuntime
impl Unpin for AiRuntime
impl UnsafeUnpin for AiRuntime
impl !UnwindSafe for AiRuntime
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more