pub struct StubBackend {
pub reply: String,
}Expand description
A deterministic fake that streams a fixed reply word by word.
Enough to exercise streaming, early-stop, and token accounting with no model present.
Fields§
§reply: StringWhat every request generates.
Trait Implementations§
Source§impl Default for StubBackend
impl Default for StubBackend
Source§impl InferBackend for StubBackend
impl InferBackend for StubBackend
Source§fn infer<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
prompt: &'life1 str,
max_tokens: u32,
on_token: &'life2 mut (dyn for<'t> FnMut(&'t str) -> bool + Send),
) -> Pin<Box<dyn Future<Output = Result<InferResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn infer<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
prompt: &'life1 str,
max_tokens: u32,
on_token: &'life2 mut (dyn for<'t> FnMut(&'t str) -> bool + Send),
) -> Pin<Box<dyn Future<Output = Result<InferResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Source§fn model_name(&self) -> String
fn model_name(&self) -> String
Identifier recorded in the job’s usage accounting.
Auto Trait Implementations§
impl Freeze for StubBackend
impl RefUnwindSafe for StubBackend
impl Send for StubBackend
impl Sync for StubBackend
impl Unpin for StubBackend
impl UnsafeUnpin for StubBackend
impl UnwindSafe for StubBackend
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
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