pub struct PreparedRequest {
pub prompt_tokens: u32,
pub context_length: Option<u32>,
/* private fields */
}Expand description
A request a ChatGenerator has readied in prepare: what the
server reads before queueing it, plus the generator’s own state for
chat_prepared, which the server carries without looking at.
Fields§
§prompt_tokens: u32The rendered prompt, in tokens, exactly as generation will see it.
context_length: Option<u32>The longest prompt the model accepts — what OpenAI’s error calls the model’s “maximum
context length”. None when the generator has no fixed limit or does not know it yet.
Implementations§
Source§impl PreparedRequest
impl PreparedRequest
Sourcepub fn new(
prompt_tokens: u32,
context_length: Option<u32>,
state: impl Any + Send,
) -> Self
pub fn new( prompt_tokens: u32, context_length: Option<u32>, state: impl Any + Send, ) -> Self
A prepared request carrying state for the generator that made it.
Sourcepub fn into_state<T: Any>(self) -> Option<T>
pub fn into_state<T: Any>(self) -> Option<T>
The state Self::new was given, or None when it is not a T — a request prepared by
another generator, which the caller then treats as unprepared.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for PreparedRequest
impl !Sync for PreparedRequest
impl !UnwindSafe for PreparedRequest
impl Forget for PreparedRequest
impl Freeze for PreparedRequest
impl Move for PreparedRequest
impl Send for PreparedRequest
impl Unpin for PreparedRequest
impl UnsafeUnpin for PreparedRequest
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
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> ⓘ
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