pub struct ModelCallbackResult {
pub success: bool,
pub duration: Duration,
pub input_tokens: Option<u32>,
pub output_tokens: Option<u32>,
pub total_tokens: Option<u32>,
pub finish_reason: Option<String>,
pub tool_calls_count: Option<u32>,
pub error: Option<String>,
pub cached: bool,
}Expand description
Result information for model completion callback
Fields§
§success: boolWhether the model call succeeded
duration: DurationDuration of model call
input_tokens: Option<u32>Input tokens used
output_tokens: Option<u32>Output tokens generated
total_tokens: Option<u32>Total tokens
finish_reason: Option<String>Finish reason (e.g., “stop”, “tool_use”, “length”)
tool_calls_count: Option<u32>Number of tool calls in response
error: Option<String>Error message if failed
cached: boolWhether response was cached
Implementations§
Source§impl ModelCallbackResult
impl ModelCallbackResult
Sourcepub fn with_tokens(self, input: u32, output: u32) -> Self
pub fn with_tokens(self, input: u32, output: u32) -> Self
Add token usage
Sourcepub fn with_finish_info(
self,
reason: impl Into<String>,
tool_calls: u32,
) -> Self
pub fn with_finish_info( self, reason: impl Into<String>, tool_calls: u32, ) -> Self
Add finish info
Trait Implementations§
Source§impl Clone for ModelCallbackResult
impl Clone for ModelCallbackResult
Source§fn clone(&self) -> ModelCallbackResult
fn clone(&self) -> ModelCallbackResult
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 ModelCallbackResult
impl Debug for ModelCallbackResult
Source§impl<'de> Deserialize<'de> for ModelCallbackResult
impl<'de> Deserialize<'de> for ModelCallbackResult
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 ModelCallbackResult
impl RefUnwindSafe for ModelCallbackResult
impl Send for ModelCallbackResult
impl Sync for ModelCallbackResult
impl Unpin for ModelCallbackResult
impl UnsafeUnpin for ModelCallbackResult
impl UnwindSafe for ModelCallbackResult
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