Package org.machanism.machai.ai.manager
Class UsageStatistics
java.lang.Object
org.machanism.machai.ai.manager.UsageStatistics
Manages and aggregates usage statistics for GenAI models.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidAdds a singleUsagerecord for a specific model identifier.Returns the aggregated usage map for all models.getUsageForModel(String modelId) Returns the aggregated usage list for a specific model.static voidlogUsage()Logs a summary of the aggregatedUsagerecords (all models).static voidlogUsageForModel(String modelId) Logs a summary of the aggregatedUsagerecords for a specific model.
-
Constructor Details
-
UsageStatistics
public UsageStatistics()
-
-
Method Details
-
addUsage
Adds a singleUsagerecord for a specific model identifier.- Parameters:
modelId- model identifier (e.g., "OpenAI:gpt-4o-mini")usage- usage to add
-
logUsage
public static void logUsage()Logs a summary of the aggregatedUsagerecords (all models). -
logUsageForModel
Logs a summary of the aggregatedUsagerecords for a specific model.- Parameters:
modelId- model identifier (e.g., "OpenAI:gpt-4o-mini")
-
getUsageForModel
Returns the aggregated usage list for a specific model.- Parameters:
modelId- model identifier- Returns:
- list of Usage records, or empty list if none
-
getAllModelUsages
Returns the aggregated usage map for all models.- Returns:
- map of modelId to list of Usage records
-