@mastra/observability 1.15.2-alpha.0 → 1.15.2-alpha.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @mastra/observability
2
2
 
3
+ ## 1.15.2-alpha.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Fixed pricing lookup when a provider-reported response model does not match a known pricing entry but the configured model does. Cost estimation now falls back to the configured model before reporting `no_matching_model`. ([#16585](https://github.com/mastra-ai/mastra/pull/16585))
8
+
9
+ - Updated dependencies [[`0200e75`](https://github.com/mastra-ai/mastra/commit/0200e7552d02d4221cd6040bf4eddf189a97a156), [`06e0d63`](https://github.com/mastra-ai/mastra/commit/06e0d63d42bc2a202e18bc091f3781f409f5e6fb), [`438a971`](https://github.com/mastra-ai/mastra/commit/438a9715c8b4398e5eaf8914a1f19dc8a85dc1de), [`77518cc`](https://github.com/mastra-ai/mastra/commit/77518ccb5bb8cc684875081e64213dc85cffdbee), [`bb2a13b`](https://github.com/mastra-ai/mastra/commit/bb2a13bb4b32e6bb807200fe7b18ae8fa4322118), [`a73cd1a`](https://github.com/mastra-ai/mastra/commit/a73cd1a62a5e4ca023dcc39ba150029f4f1f74c1), [`0b5cc47`](https://github.com/mastra-ai/mastra/commit/0b5cc4726dc18d9a685a27520db39ff1b36bb89a), [`87f38a3`](https://github.com/mastra-ai/mastra/commit/87f38a3de03e24731f2dd6f8ed6a60b6722b85a1), [`d5fa3cd`](https://github.com/mastra-ai/mastra/commit/d5fa3cda1788c3cb93a361a3c6ec47de6ba21e98), [`fe98ef2`](https://github.com/mastra-ai/mastra/commit/fe98ef2e66dbfcbd7d645c88c9ee1e67b458a136), [`793ea0f`](https://github.com/mastra-ai/mastra/commit/793ea0f52f831178837f21c83af6af93bf4ce638), [`507a5c4`](https://github.com/mastra-ai/mastra/commit/507a5c461bdc3136ad80744c0efbb55ce1f18f97), [`79b3626`](https://github.com/mastra-ai/mastra/commit/79b3626f8d647307eb07c8da14c9073c2699719d)]:
10
+ - @mastra/core@1.47.0-alpha.6
11
+
3
12
  ## 1.15.2-alpha.0
4
13
 
5
14
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -1451,6 +1451,16 @@ function emitUsageMetrics(attrs, usage, metrics) {
1451
1451
  model,
1452
1452
  usage
1453
1453
  });
1454
+ if (isNoMatchingModelResult(metricCosts) && attrs.model && attrs.model !== model) {
1455
+ const configuredModelCosts = estimateCosts({
1456
+ provider,
1457
+ model: attrs.model,
1458
+ usage
1459
+ });
1460
+ if (!isNoMatchingModelResult(configuredModelCosts)) {
1461
+ metricCosts = configuredModelCosts;
1462
+ }
1463
+ }
1454
1464
  }
1455
1465
  } catch {
1456
1466
  metricCosts = /* @__PURE__ */ new Map();
@@ -1468,6 +1478,9 @@ function emitUsageMetrics(attrs, usage, metrics) {
1468
1478
  emit(sample.name, sample.value);
1469
1479
  }
1470
1480
  }
1481
+ function isNoMatchingModelResult(metricCosts) {
1482
+ return metricCosts.size > 0 && [...metricCosts.values()].every((costContext) => costContext.costMetadata?.error === "no_matching_model");
1483
+ }
1471
1484
  function getProvidedCostContext(attrs, usage) {
1472
1485
  const costContext = attrs.costContext;
1473
1486
  if (typeof costContext?.estimatedCost !== "number") {