@mastra/observability 1.10.1-alpha.0 → 1.10.2-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -18533,6 +18533,9 @@ function extractUsageMetrics(usage, providerMetadata) {
18533
18533
  if (!isDefined(inputDetails.cacheRead) && isDefined(usage.cachedInputTokens)) {
18534
18534
  inputDetails.cacheRead = usage.cachedInputTokens;
18535
18535
  }
18536
+ if (!isDefined(inputDetails.cacheWrite) && isDefined(usage.cacheCreationInputTokens)) {
18537
+ inputDetails.cacheWrite = usage.cacheCreationInputTokens;
18538
+ }
18536
18539
  if (isDefined(usage.reasoningTokens)) {
18537
18540
  outputDetails.reasoning = usage.reasoningTokens;
18538
18541
  }
@@ -18546,7 +18549,7 @@ function extractUsageMetrics(usage, providerMetadata) {
18546
18549
  if (!isDefined(inputDetails.cacheWrite) && isDefined(anthropic.cacheCreationInputTokens)) {
18547
18550
  inputDetails.cacheWrite = anthropic.cacheCreationInputTokens;
18548
18551
  }
18549
- const inputAlreadyIncludesCache = hasV3CachedTotals || isDefined(usage.cachedInputTokens) && usage.cachedInputTokens > 0;
18552
+ const inputAlreadyIncludesCache = hasV3CachedTotals || isDefined(usage.cachedInputTokens) && usage.cachedInputTokens > 0 || isDefined(usage.cacheCreationInputTokens) && usage.cacheCreationInputTokens > 0;
18550
18553
  if (!inputAlreadyIncludesCache && (isDefined(inputDetails.cacheRead) || isDefined(inputDetails.cacheWrite))) {
18551
18554
  inputTokens = (usage.inputTokens ?? 0) + (inputDetails.cacheRead ?? 0) + (inputDetails.cacheWrite ?? 0);
18552
18555
  }