pub struct ChatCompletion {
pub value: Value,
pub cost_usd: f64,
pub finish_reason: Option<String>,
pub prompt_tokens: Option<u32>,
pub completion_tokens: Option<u32>,
}Expand description
Successful OpenRouterChatClient::complete result (GAP-SG-72-chat).
finish_reason, prompt_tokens and completion_tokens are the raw
diagnostics OpenRouter attached to the response that ultimately succeeded
(after any max_tokens growth retries — see Self::value and the
module docs). They are None only when the provider omitted them.
Fields§
§value: ValueModel output parsed as JSON (guaranteed to be a JSON object).
cost_usd: f64Cost in USD read from usage.cost, or 0.0 when the provider omitted it.
finish_reason: Option<String>choices[0].finish_reason from the response that produced value.
prompt_tokens: Option<u32>usage.prompt_tokens from the response that produced value.
completion_tokens: Option<u32>usage.completion_tokens from the response that produced value.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ChatCompletion
impl RefUnwindSafe for ChatCompletion
impl Send for ChatCompletion
impl Sync for ChatCompletion
impl Unpin for ChatCompletion
impl UnsafeUnpin for ChatCompletion
impl UnwindSafe for ChatCompletion
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<T> ErasedDestructor for Twhere
T: 'static,
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