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,
pub tool_calls: Option<Vec<ToolCall>>,
}Fields§
§id: StringA unique identifier for the chat completion.
index: Option<u32>If batched, the index of the choice in the list of choices.
content: StringThe generated completion.
finish_reason: CompletionFinishReason§completion_probabilities: Option<Vec<InferenceProbabilities>>§truncated: boolTrue 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§tool_calls: Option<Vec<ToolCall>>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>
Trait Implementations§
Source§impl Display for CompletionResponse
impl Display for CompletionResponse
Source§impl ResponseContent for CompletionResponse
impl ResponseContent for CompletionResponse
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
Fallible version of
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
Converts the given value to a
CompactString. Read moreSource§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.