mirror of
https://github.com/aljazceru/goose.git
synced 2025-12-18 14:44:21 +01:00
refactor: clean up log usage (#1704)
This commit is contained in:
@@ -48,17 +48,7 @@ impl BenchAgent for BenchSession {
|
||||
}
|
||||
|
||||
async fn get_token_usage(&self) -> Option<i32> {
|
||||
// Get token usage from the provider
|
||||
if let Ok(usage) = self.session.get_usage().await {
|
||||
// Sum up total tokens across all usage entries
|
||||
let total_tokens = usage
|
||||
.iter()
|
||||
.map(|u| u.usage.total_tokens.unwrap_or(0))
|
||||
.sum();
|
||||
Some(total_tokens)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
self.session.get_total_token_usage().ok().flatten()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user