pub struct AnthropicCompletionResponse {
pub id: String,
pub content: Vec<CompletionContent>,
pub model: String,
pub stop_reason: StopReason,
pub stop_sequence: Option<String>,
pub usage: CompletionUsage,
}Expand description
Represents a chat completion response returned by model, based on the provided input.
Fields§
§id: StringUnique object identifier.
The format and length of IDs may change over time.
content: Vec<CompletionContent>Content generated by the model.
This is an array of content blocks, each of which has a type that determines its shape. Currently, the only type in responses is “text”.
model: StringThe model that handled the request.
stop_reason: StopReasonThe reason that we stopped.
This may be one of the following values:
“end_turn”: the model reached a natural stopping point “max_tokens”: we exceeded the requested max_tokens or the model’s maximum “stop_sequence”: one of your provided custom stop_sequences was generated
stop_sequence: Option<String>Which custom stop sequence was generated, if any.
This value will be a non-null string if one of your custom stop sequences was generated.
usage: CompletionUsageBilling and rate-limit usage.
Anthropic’s API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.
Under the hood, the API transforms requests into a format suitable for the model. The model’s output then goes through a parsing stage before becoming an API response. As a result, the token counts in usage will not match one-to-one with the exact visible content of an API request or response.
For example, output_tokens will be non-zero, even for an empty string response from Claude.
Trait Implementations§
Source§impl Clone for AnthropicCompletionResponse
impl Clone for AnthropicCompletionResponse
Source§fn clone(&self) -> AnthropicCompletionResponse
fn clone(&self) -> AnthropicCompletionResponse
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AnthropicCompletionResponse
impl Debug for AnthropicCompletionResponse
Source§impl<'de> Deserialize<'de> for AnthropicCompletionResponse
impl<'de> Deserialize<'de> for AnthropicCompletionResponse
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl StructuralPartialEq for AnthropicCompletionResponse
Auto Trait Implementations§
impl Freeze for AnthropicCompletionResponse
impl RefUnwindSafe for AnthropicCompletionResponse
impl Send for AnthropicCompletionResponse
impl Sync for AnthropicCompletionResponse
impl Unpin for AnthropicCompletionResponse
impl UnwindSafe for AnthropicCompletionResponse
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
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