groqUsageFromAudioJson static method

GroqUsage groqUsageFromAudioJson(
  1. Map<String, dynamic> json
)

Implementation

static GroqUsage groqUsageFromAudioJson(Map<String, dynamic> json) {
  return GroqUsage(
    promptTokens: json['prompt_tokens'] as int,
    completionTokens: json['completion_tokens'] as int,
    // it is stored in json as 0.001 seconds e.g.
    promptTime: Duration.zero,
    completionTime: Duration(
        milliseconds: ((json['total_time'] as double) * 1000).toInt()),
  );
}