pub struct BatchResult {
pub successful: Vec<ChatCompletionResponse>,
pub failed: Vec<(usize, AiLibError)>,
pub total_requests: usize,
pub total_successful: usize,
pub total_failed: usize,
}
Expand description
批处理结果,包含成功和失败的响应
Batch processing result containing successful and failed responses
Fields§
§successful: Vec<ChatCompletionResponse>
§failed: Vec<(usize, AiLibError)>
§total_requests: usize
§total_successful: usize
§total_failed: usize
Implementations§
Source§impl BatchResult
impl BatchResult
Sourcepub fn add_success(&mut self, response: ChatCompletionResponse)
pub fn add_success(&mut self, response: ChatCompletionResponse)
Add a successful response
Sourcepub fn add_failure(&mut self, index: usize, error: AiLibError)
pub fn add_failure(&mut self, index: usize, error: AiLibError)
Add a failed response with index
Sourcepub fn all_successful(&self) -> bool
pub fn all_successful(&self) -> bool
Check if all requests were successful
Sourcepub fn success_rate(&self) -> f64
pub fn success_rate(&self) -> f64
Get success rate as a percentage
Trait Implementations§
Auto Trait Implementations§
impl Freeze for BatchResult
impl !RefUnwindSafe for BatchResult
impl Send for BatchResult
impl Sync for BatchResult
impl Unpin for BatchResult
impl !UnwindSafe for BatchResult
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