@anyway-sh/node-server-sdk 0.22.11 → 0.22.12

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
@@ -90,7 +90,7 @@ class PromptNotFoundError extends TraceloopError {
90
90
  }
91
91
  }
92
92
 
93
- var version = "0.22.11";
93
+ var version = "0.22.12";
94
94
 
95
95
  /**
96
96
  * Base class for handling annotation operations with the Traceloop API.
@@ -3905,6 +3905,7 @@ class PricingCalculator {
3905
3905
  return null;
3906
3906
  }
3907
3907
  addCostAttributes(span) {
3908
+ var _a, _b;
3908
3909
  const attrs = span.attributes;
3909
3910
  if (!attrs)
3910
3911
  return;
@@ -3912,8 +3913,8 @@ class PricingCalculator {
3912
3913
  attrs[incubating.ATTR_GEN_AI_REQUEST_MODEL];
3913
3914
  if (!model)
3914
3915
  return;
3915
- const inputTokens = attrs[incubating.ATTR_GEN_AI_USAGE_INPUT_TOKENS];
3916
- const outputTokens = attrs[incubating.ATTR_GEN_AI_USAGE_OUTPUT_TOKENS];
3916
+ const inputTokens = ((_a = attrs[incubating.ATTR_GEN_AI_USAGE_INPUT_TOKENS]) !== null && _a !== void 0 ? _a : attrs[incubating.ATTR_GEN_AI_USAGE_PROMPT_TOKENS]);
3917
+ const outputTokens = ((_b = attrs[incubating.ATTR_GEN_AI_USAGE_OUTPUT_TOKENS]) !== null && _b !== void 0 ? _b : attrs[incubating.ATTR_GEN_AI_USAGE_COMPLETION_TOKENS]);
3917
3918
  if (inputTokens == null && outputTokens == null)
3918
3919
  return;
3919
3920
  const pricing = this.findPricing(model);