pub struct CompletionResponse {
pub id: String,
pub index: Option<u32>,
pub content: String,
pub finish_reason: CompletionFinishReason,
pub completion_probabilities: Option<Vec<InferenceProbabilities>>,
pub truncated: bool,
pub generation_settings: GenerationSettings,
pub timing_usage: TimingUsage,
pub token_usage: TokenUsage,
}
Fields§
§id: String
A unique identifier for the chat completion.
index: Option<u32>
If batched, the index of the choice in the list of choices.
content: String
The generated completion.
finish_reason: CompletionFinishReason
§completion_probabilities: Option<Vec<InferenceProbabilities>>
§truncated: bool
True if the context size was exceeded during generation, i.e. the number of tokens provided in the prompt (tokens_evaluated) plus tokens generated (tokens predicted) exceeded the context size (n_ctx)
generation_settings: GenerationSettings
§timing_usage: TimingUsage
§token_usage: TokenUsage
Implementations§
Source§impl CompletionResponse
impl CompletionResponse
pub fn new_from_anthropic( req: &CompletionRequest, res: AnthropicCompletionResponse, ) -> Result<CompletionResponse, CompletionError>
Source§impl CompletionResponse
impl CompletionResponse
pub fn new_from_openai( req: &CompletionRequest, res: OpenAiCompletionResponse, ) -> Result<CompletionResponse, CompletionError>
Source§impl CompletionResponse
impl CompletionResponse
pub fn new_from_llama( req: &CompletionRequest, res: LlamaCppCompletionResponse, ) -> Result<CompletionResponse, CompletionError>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CompletionResponse
impl RefUnwindSafe for CompletionResponse
impl Send for CompletionResponse
impl Sync for CompletionResponse
impl Unpin for CompletionResponse
impl UnwindSafe for CompletionResponse
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> 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