@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.mjs CHANGED
@@ -21,7 +21,7 @@ import { QdrantInstrumentation } from '@traceloop/instrumentation-qdrant';
21
21
  import { TogetherInstrumentation } from '@traceloop/instrumentation-together';
22
22
  import { McpInstrumentation } from '@traceloop/instrumentation-mcp';
23
23
  import { SimpleSpanProcessor, BatchSpanProcessor } from '@opentelemetry/sdk-trace-node';
24
- import { ATTR_GEN_AI_OPERATION_NAME, ATTR_GEN_AI_REQUEST_MODEL, ATTR_GEN_AI_COMPLETION, ATTR_GEN_AI_OUTPUT_MESSAGES, ATTR_GEN_AI_PROMPT, ATTR_GEN_AI_INPUT_MESSAGES, ATTR_GEN_AI_USAGE_INPUT_TOKENS, ATTR_GEN_AI_USAGE_OUTPUT_TOKENS, ATTR_GEN_AI_RESPONSE_FINISH_REASONS, ATTR_GEN_AI_RESPONSE_MODEL, ATTR_GEN_AI_RESPONSE_ID, ATTR_GEN_AI_SYSTEM, ATTR_GEN_AI_PROVIDER_NAME, ATTR_GEN_AI_CONVERSATION_ID, ATTR_GEN_AI_TOOL_NAME, ATTR_GEN_AI_TOOL_CALL_ID, ATTR_GEN_AI_TOOL_CALL_ARGUMENTS, ATTR_GEN_AI_TOOL_CALL_RESULT, ATTR_GEN_AI_AGENT_NAME } from '@opentelemetry/semantic-conventions/incubating';
24
+ import { ATTR_GEN_AI_OPERATION_NAME, ATTR_GEN_AI_REQUEST_MODEL, ATTR_GEN_AI_COMPLETION, ATTR_GEN_AI_OUTPUT_MESSAGES, ATTR_GEN_AI_PROMPT, ATTR_GEN_AI_INPUT_MESSAGES, ATTR_GEN_AI_USAGE_INPUT_TOKENS, ATTR_GEN_AI_USAGE_OUTPUT_TOKENS, ATTR_GEN_AI_RESPONSE_FINISH_REASONS, ATTR_GEN_AI_RESPONSE_MODEL, ATTR_GEN_AI_RESPONSE_ID, ATTR_GEN_AI_SYSTEM, ATTR_GEN_AI_PROVIDER_NAME, ATTR_GEN_AI_CONVERSATION_ID, ATTR_GEN_AI_TOOL_NAME, ATTR_GEN_AI_TOOL_CALL_ID, ATTR_GEN_AI_TOOL_CALL_ARGUMENTS, ATTR_GEN_AI_TOOL_CALL_RESULT, ATTR_GEN_AI_AGENT_NAME, ATTR_GEN_AI_USAGE_PROMPT_TOKENS, ATTR_GEN_AI_USAGE_COMPLETION_TOKENS } from '@opentelemetry/semantic-conventions/incubating';
25
25
  import fetch$1 from 'cross-fetch';
26
26
  import fetchBuilder from 'fetch-retry';
27
27
  import { suppressTracing } from '@opentelemetry/core';
@@ -66,7 +66,7 @@ class PromptNotFoundError extends TraceloopError {
66
66
  }
67
67
  }
68
68
 
69
- var version = "0.22.11";
69
+ var version = "0.22.12";
70
70
 
71
71
  /**
72
72
  * Base class for handling annotation operations with the Traceloop API.
@@ -3881,6 +3881,7 @@ class PricingCalculator {
3881
3881
  return null;
3882
3882
  }
3883
3883
  addCostAttributes(span) {
3884
+ var _a, _b;
3884
3885
  const attrs = span.attributes;
3885
3886
  if (!attrs)
3886
3887
  return;
@@ -3888,8 +3889,8 @@ class PricingCalculator {
3888
3889
  attrs[ATTR_GEN_AI_REQUEST_MODEL];
3889
3890
  if (!model)
3890
3891
  return;
3891
- const inputTokens = attrs[ATTR_GEN_AI_USAGE_INPUT_TOKENS];
3892
- const outputTokens = attrs[ATTR_GEN_AI_USAGE_OUTPUT_TOKENS];
3892
+ const inputTokens = ((_a = attrs[ATTR_GEN_AI_USAGE_INPUT_TOKENS]) !== null && _a !== void 0 ? _a : attrs[ATTR_GEN_AI_USAGE_PROMPT_TOKENS]);
3893
+ const outputTokens = ((_b = attrs[ATTR_GEN_AI_USAGE_OUTPUT_TOKENS]) !== null && _b !== void 0 ? _b : attrs[ATTR_GEN_AI_USAGE_COMPLETION_TOKENS]);
3893
3894
  if (inputTokens == null && outputTokens == null)
3894
3895
  return;
3895
3896
  const pricing = this.findPricing(model);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anyway-sh/node-server-sdk",
3
- "version": "0.22.11",
3
+ "version": "0.22.12",
4
4
  "description": "Anyway Software Development Kit (SDK) for Node.js",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",