pub struct AppState { /* private fields */ }Expand description
Shared server state — a non-empty, ordered set of hosted ModelEntrys. A request is routed to
the entry whose id matches its model field; an unknown/empty model falls to the DEFAULT
(the first entry). The single-model server is just the one-entry case, so its behaviour — and the
hot path — is byte-identical to before this became multi-model.
Implementations§
Source§impl AppState
impl AppState
Sourcepub fn new(
generator: Arc<dyn ChatGenerator>,
model_id: impl Into<String>,
n_parallel: usize,
cfg: Arc<Config>,
) -> Self
pub fn new( generator: Arc<dyn ChatGenerator>, model_id: impl Into<String>, n_parallel: usize, cfg: Arc<Config>, ) -> Self
Wrap a single loaded generator for production use with n_parallel concurrent slots — the
single-model server (the overwhelming common case). Equivalent to a one-entry
multi.
Sourcepub fn multi(
entries: Vec<(String, Arc<dyn ChatGenerator>, usize)>,
cfg: Arc<Config>,
) -> Self
pub fn multi( entries: Vec<(String, Arc<dyn ChatGenerator>, usize)>, cfg: Arc<Config>, ) -> Self
Host SEVERAL models at once, each with its OWN generator and per-model slot count. Each
(model_id, generator, n_parallel) becomes a routable entry; the FIRST is the default route
(used for a request with an unknown or empty model). This is the multi-device host: pass a
generator pinned to each physical GPU and the server routes by model name — see infr multi.
Panics if entries is empty (the state invariant is a non-empty model set); the CLI never
calls it with none.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for AppState
impl !UnwindSafe for AppState
impl Forget for AppState
impl Freeze for AppState
impl Move for AppState
impl Send for AppState
impl Sync for AppState
impl Unpin for AppState
impl UnsafeUnpin for AppState
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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> ⓘ
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> ⓘ
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