pub struct InferRequest<'a> {
pub prompt: &'a str,
pub max_tokens: u32,
pub images: &'a [Vec<u8>],
}Expand description
One inference request.
A struct rather than a growing parameter list. images was added after the
fact and would have broken every implementation had it been positional;
temperature, grammars, and stop sequences are all coming, and each would do
the same. Adding a field here with a sensible default does not.
Fields§
§prompt: &'a strWhat to generate from.
max_tokens: u32Upper bound on generated tokens.
images: &'a [Vec<u8>]Images accompanying the prompt, already loaded by the host.
Empty for ordinary text inference. A backend whose model has no vision capability should fail loudly rather than ignore these — silently dropping an image produces an answer about nothing, which is worse than an error because it looks like a bad model.
Implementations§
Trait Implementations§
Source§impl<'a> Debug for InferRequest<'a>
impl<'a> Debug for InferRequest<'a>
Source§impl<'a> Default for InferRequest<'a>
impl<'a> Default for InferRequest<'a>
Source§fn default() -> InferRequest<'a>
fn default() -> InferRequest<'a>
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl<'a> Freeze for InferRequest<'a>
impl<'a> RefUnwindSafe for InferRequest<'a>
impl<'a> Send for InferRequest<'a>
impl<'a> Sync for InferRequest<'a>
impl<'a> Unpin for InferRequest<'a>
impl<'a> UnsafeUnpin for InferRequest<'a>
impl<'a> UnwindSafe for InferRequest<'a>
Blanket Implementations§
impl<T> Allocation for T
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