pub struct RuntimeAdapter<'runtime> {
pub kind: BackendKind,
pub binary: PathBuf,
pub http: &'runtime dyn Transport,
pub probe: &'runtime dyn ProcessProbe,
pub control: &'runtime dyn ProcessControl,
/* private fields */
}Fields§
§kind: BackendKind§binary: PathBuf§http: &'runtime dyn Transport§probe: &'runtime dyn ProcessProbe§control: &'runtime dyn ProcessControlImplementations§
Source§impl<'runtime> RuntimeAdapter<'runtime>
impl<'runtime> RuntimeAdapter<'runtime>
pub fn new( kind: BackendKind, binary: PathBuf, http: &'runtime dyn Transport, probe: &'runtime dyn ProcessProbe, control: &'runtime dyn ProcessControl, ) -> Self
pub fn with_ollama_models(self, models: PathBuf) -> Result<Self, BackendError>
pub async fn ready( &self, request: &ServeRequest, cancel: &CancellationToken, ) -> Result<(), BackendError>
pub async fn serve( &self, request: &ServeRequest, cancel: &CancellationToken, ) -> Result<ServerState, BackendError>
pub async fn stop( &self, handle: &ServerState, cancel: &CancellationToken, ) -> Result<(), BackendError>
Trait Implementations§
Source§impl BackendAdapter for RuntimeAdapter<'_>
impl BackendAdapter for RuntimeAdapter<'_>
fn attach_only<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
request: &'life1 ServeRequest,
cancel: &'life2 CancellationToken,
) -> Pin<Box<dyn Future<Output = Result<ServerState, BackendError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn ready_handle<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
request: &'life1 ServeRequest,
handle: &'life2 ServerState,
cancel: &'life3 CancellationToken,
) -> Pin<Box<dyn Future<Output = Result<(), BackendError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn name(&self) -> &'static str
fn trusts(&self, identity: &ProcessIdentity) -> bool
fn chat<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
handle: &'life1 ServerState,
input: &'life2 ChatInput,
cancel: &'life3 CancellationToken,
) -> Pin<Box<dyn Future<Output = Result<ChatResult, BackendError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn chat_stream<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
handle: &'life1 ServerState,
input: &'life2 ChatInput,
cancel: &'life3 CancellationToken,
on_delta: &'life4 mut (dyn for<'chunk> FnMut(&'chunk str) + Send),
) -> Pin<Box<dyn Future<Output = Result<ChatResult, BackendError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn embed<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
handle: &'life1 ServerState,
model: &'life2 str,
inputs: &'life3 [String],
cancel: &'life4 CancellationToken,
) -> Pin<Box<dyn Future<Output = Result<EmbedResult, BackendError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn serve<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
request: &'life1 ServeRequest,
cancel: &'life2 CancellationToken,
) -> Pin<Box<dyn Future<Output = Result<ServerState, BackendError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn ready<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
request: &'life1 ServeRequest,
cancel: &'life2 CancellationToken,
) -> Pin<Box<dyn Future<Output = Result<(), BackendError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn stop<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
handle: &'life1 ServerState,
cancel: &'life2 CancellationToken,
) -> Pin<Box<dyn Future<Output = Result<(), BackendError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn can_embed(&self) -> bool
fn can_stream(&self) -> bool
Auto Trait Implementations§
impl<'runtime> !RefUnwindSafe for RuntimeAdapter<'runtime>
impl<'runtime> !UnwindSafe for RuntimeAdapter<'runtime>
impl<'runtime> Freeze for RuntimeAdapter<'runtime>
impl<'runtime> Send for RuntimeAdapter<'runtime>
impl<'runtime> Sync for RuntimeAdapter<'runtime>
impl<'runtime> Unpin for RuntimeAdapter<'runtime>
impl<'runtime> UnsafeUnpin for RuntimeAdapter<'runtime>
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