pub struct TrackingDb { /* private fields */ }Expand description
SQLite database for tracking LLM usage
Implementations§
Source§impl TrackingDb
impl TrackingDb
Sourcepub fn open(db_path: &Path) -> Result<Self, LlmError>
pub fn open(db_path: &Path) -> Result<Self, LlmError>
Open tracking database at a specific path (for testing)
Sourcepub fn new_in_memory() -> Result<Self, LlmError>
pub fn new_in_memory() -> Result<Self, LlmError>
Create an in-memory database (for testing)
Sourcepub fn track_request(
&self,
model: &str,
input_tokens: u64,
output_tokens: u64,
cost: f64,
duration_ms: u64,
) -> Result<(), LlmError>
pub fn track_request( &self, model: &str, input_tokens: u64, output_tokens: u64, cost: f64, duration_ms: u64, ) -> Result<(), LlmError>
Track a new LLM request
Sourcepub fn get_usage_stats(&self, days: u32) -> Result<UsageStats, LlmError>
pub fn get_usage_stats(&self, days: u32) -> Result<UsageStats, LlmError>
Get usage statistics for the last N days
Auto Trait Implementations§
impl Freeze for TrackingDb
impl RefUnwindSafe for TrackingDb
impl Send for TrackingDb
impl Sync for TrackingDb
impl Unpin for TrackingDb
impl UnsafeUnpin for TrackingDb
impl UnwindSafe for TrackingDb
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