call_logging
CostTracker
Methods
init
__init__(self, name: str)add_log
add_log(self, log: 'CallLog')get_logs
get_logs(self) -> List['CallLog']get_total_cost
get_total_cost(self) -> floatstart_tracking
start_tracking()stop_tracking
stop_tracking()get_tracked_logs
get_tracked_logs() -> List['CallLog']_add_log_to_tracker
_add_log_to_tracker(call_log: 'CallLog', cache_hit: bool)Adds a call log to the global tracker if tracking is enabled. This is done in _llm_func_factory
print_tracking_stats
print_tracking_stats(
call_logs: Union[List['CallLog'], None],
prepend: str,
get_as_str: bool
) -> strCallLog
Inherits from: BaseModel
set_call_log_save_path
set_call_log_save_path(path: Path)get_cached_call_log
get_cached_call_log(cache_key, cache_path)get_call_logs
get_call_logs(model: Optional[str]) -> List[CallLog]get_total_costs
get_total_costs(model: Optional[str]) -> floatget_total_input_tokens
get_total_input_tokens(model: Optional[str]) -> intget_total_output_tokens
get_total_output_tokens(model: Optional[str]) -> intget_total_tokens
get_total_tokens(model: Optional[str]) -> intsave_call_log
save_call_log(path: Path, combine_with_existing: bool)load_call_log_file
load_call_log_file(path: Optional[Path]) -> List[CallLog]