pub struct ApiResponse {
pub id: String,
pub content: String,
pub finish_reason: String,
pub prompt_tokens: u32,
pub completion_tokens: u32,
pub total_tokens: u32,
pub choices: Vec<Choice>,
}Expand description
Represents the overall structure of a successful response from the AI chat completion API.
Fields§
§id: StringA unique identifier for the API response.
content: StringThe generated text content.
finish_reason: StringThe reason the AI model stopped generating tokens (e.g., “stop”, “tool_calls”).
prompt_tokens: u32Number of tokens used in the prompt.
completion_tokens: u32Number of tokens used in the completion.
total_tokens: u32Total number of tokens used.
choices: Vec<Choice>A list of completion choices. Currently, only the first choice is used by the Agent.
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