pub struct TokenLogprob {
pub token: u32,
pub text: String,
pub bytes: Vec<u8>,
pub logprob: f32,
pub top: Vec<TokenLogprobAlt>,
}Expand description
One generated token’s log probability and, when the request asked for them, its most likely
alternatives. text/bytes are filled in by the backend that owns the tokenizer; the decode
loop only knows the id and the probabilities.
Fields§
§token: u32§text: StringThe token decoded on its own. May be a replacement character for a byte-fallback token whose bytes only complete in context.
bytes: Vec<u8>The bytes of text, as OpenAI’s bytes array.
logprob: f32Natural log of the token’s probability: the log-softmax of the logits row it was sampled
from, after logit_bias and the penalties, before temperature and the truncating samplers
(top-k, top-p, min-p).
top: Vec<TokenLogprobAlt>The most likely tokens at this position, at most the request’s top_logprobs, descending
by probability. Does not necessarily contain token.
Implementations§
Source§impl TokenLogprob
impl TokenLogprob
Sourcepub fn unresolved(
token: u32,
logprob: f32,
top: Vec<TokenLogprobAlt>,
) -> TokenLogprob
pub fn unresolved( token: u32, logprob: f32, top: Vec<TokenLogprobAlt>, ) -> TokenLogprob
A token id and its probability, before the tokenizer-dependent fields are filled in.
Trait Implementations§
Source§impl Clone for TokenLogprob
impl Clone for TokenLogprob
Source§fn clone(&self) -> TokenLogprob
fn clone(&self) -> TokenLogprob
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TokenLogprob
impl Debug for TokenLogprob
Source§impl PartialEq for TokenLogprob
impl PartialEq for TokenLogprob
impl StructuralPartialEq for TokenLogprob
Auto Trait Implementations§
impl Forget for TokenLogprob
impl Freeze for TokenLogprob
impl Move for TokenLogprob
impl RefUnwindSafe for TokenLogprob
impl Send for TokenLogprobwhere
RawVecInner: Send,
impl Sync for TokenLogprobwhere
RawVecInner: Sync,
impl Unpin for TokenLogprob
impl UnsafeUnpin for TokenLogprobwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<TokenLogprobAlt>: UnsafeUnpin,
impl UnwindSafe for TokenLogprobwhere
RawVecInner: UnwindSafe,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> ⓘ
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> ⓘ
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