pub struct ApiResponse {
pub id: String,
pub response_type: String,
pub role: String,
pub content: Vec<ContentBlock>,
pub model: String,
pub stop_reason: Option<StopReason>,
pub stop_sequence: Option<String>,
pub usage: Usage,
pub context_management: Option<ContextManagementResponse>,
}Fields§
§id: String§response_type: String§role: String§content: Vec<ContentBlock>§model: String§stop_reason: Option<StopReason>§stop_sequence: Option<String>§usage: Usage§context_management: Option<ContextManagementResponse>Implementations§
Source§impl ApiResponse
impl ApiResponse
pub fn text(&self) -> String
pub fn wants_tool_use(&self) -> bool
pub fn tool_uses(&self) -> Vec<&ToolUseBlock>
pub fn thinking_blocks(&self) -> Vec<&ThinkingBlock>
pub fn has_thinking(&self) -> bool
pub fn all_citations(&self) -> Vec<&Citation>
pub fn has_citations(&self) -> bool
pub fn citations_by_document(&self) -> HashMap<usize, Vec<&Citation>>
pub fn search_citations(&self) -> Vec<&SearchResultLocationCitation>
pub fn applied_edits(&self) -> &[AppliedEdit]
pub fn cleared_tokens(&self) -> u64
Sourcepub fn server_tool_uses(&self) -> Vec<&ServerToolUseBlock>
pub fn server_tool_uses(&self) -> Vec<&ServerToolUseBlock>
Get server-side tool uses from the response content.
Sourcepub fn has_server_tool_use(&self) -> bool
pub fn has_server_tool_use(&self) -> bool
Check if the response contains any server-side tool use.
Sourcepub fn server_web_search_requests(&self) -> u32
pub fn server_web_search_requests(&self) -> u32
Get server-side web search request count from usage.
Sourcepub fn server_web_fetch_requests(&self) -> u32
pub fn server_web_fetch_requests(&self) -> u32
Get server-side web fetch request count from usage.
Trait Implementations§
Source§impl Clone for ApiResponse
impl Clone for ApiResponse
Source§fn clone(&self) -> ApiResponse
fn clone(&self) -> ApiResponse
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ApiResponse
impl Debug for ApiResponse
Source§impl<'de> Deserialize<'de> for ApiResponse
impl<'de> Deserialize<'de> for ApiResponse
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ApiResponse
impl RefUnwindSafe for ApiResponse
impl Send for ApiResponse
impl Sync for ApiResponse
impl Unpin for ApiResponse
impl UnwindSafe for ApiResponse
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<D> DeserializeWith<JsonFormat> for Dwhere
D: DeserializeOwned,
impl<D> DeserializeWith<JsonFormat> for Dwhere
D: DeserializeOwned,
Source§fn deserialize_with(body: ResponseBody) -> Result<D, Error>
fn deserialize_with(body: ResponseBody) -> Result<D, Error>
Deserialize the response body using the specified format. Read more
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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 moreCreates a shared type from an unshared type.