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. Registered as the stub provider, so a spec can select it with
model = Stub "anything" — which makes it possible to test a pipeline end to
end without depending on a model’s wording, or on a model at all.
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 supports_images(&self) -> bool
fn supports_images(&self) -> bool
The stub accepts images so a multimodal pipeline is testable without a vision model — but it reports what it received rather than discarding it. Silently ignoring images is the failure this whole guard exists to prevent; a test backend that does it cannot catch anyone else doing it.
Source§fn infer<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
req: InferRequest<'life1>,
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,
req: InferRequest<'life1>,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> ⓘ
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