concat method

Merges this usage with another by summing the values.

Implementation

LanguageModelUsage concat(final LanguageModelUsage other) {
  return LanguageModelUsage(
    promptTokens: promptTokens == null && other.promptTokens == null
        ? null
        : (promptTokens ?? 0) + (other.promptTokens ?? 0),
    promptBillableCharacters: promptBillableCharacters == null &&
            other.promptBillableCharacters == null
        ? null
        : (promptBillableCharacters ?? 0) +
            (other.promptBillableCharacters ?? 0),
    responseTokens: responseTokens == null && other.responseTokens == null
        ? null
        : (responseTokens ?? 0) + (other.responseTokens ?? 0),
    responseBillableCharacters: responseBillableCharacters == null &&
            other.responseBillableCharacters == null
        ? null
        : (responseBillableCharacters ?? 0) +
            (other.responseBillableCharacters ?? 0),
    totalTokens: totalTokens == null && other.totalTokens == null
        ? null
        : (totalTokens ?? 0) + (other.totalTokens ?? 0),
  );
}