@paid-ai/paid-node 0.0.8-alpha0 → 0.0.8-alpha1
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.
|
@@ -99,7 +99,6 @@ class ResponsesWrapper {
|
|
|
99
99
|
}
|
|
100
100
|
create(params) {
|
|
101
101
|
return __awaiter(this, void 0, void 0, function* () {
|
|
102
|
-
var _a;
|
|
103
102
|
const currentSpan = api_1.trace.getSpan(api_1.context.active());
|
|
104
103
|
if (!currentSpan) {
|
|
105
104
|
console.warn("No active span found, calling OpenAI directly without tracing.");
|
|
@@ -107,9 +106,8 @@ class ResponsesWrapper {
|
|
|
107
106
|
}
|
|
108
107
|
const externalCustomerId = (0, tracing_1.getCustomerId)();
|
|
109
108
|
const token = (0, tracing_1.getTokenStorage)();
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
return this.tracer.startActiveSpan(spanName, (span) => __awaiter(this, void 0, void 0, function* () {
|
|
109
|
+
return this.tracer.startActiveSpan("trace.openai.responses", (span) => __awaiter(this, void 0, void 0, function* () {
|
|
110
|
+
var _a, _b;
|
|
113
111
|
const attributes = {
|
|
114
112
|
"gen_ai.system": "openai",
|
|
115
113
|
"gen_ai.operation.name": "chat", // Equivalent to chat.completions
|
|
@@ -125,10 +123,16 @@ class ResponsesWrapper {
|
|
|
125
123
|
const response = yield this.openai.responses.create(params);
|
|
126
124
|
if (response.usage) {
|
|
127
125
|
span.setAttributes({
|
|
128
|
-
"gen_ai.usage.input_tokens": response.usage.
|
|
129
|
-
"gen_ai.usage.output_tokens": response.usage.
|
|
126
|
+
"gen_ai.usage.input_tokens": response.usage.input_tokens,
|
|
127
|
+
"gen_ai.usage.output_tokens": response.usage.output_tokens,
|
|
130
128
|
"gen_ai.response.model": response.model,
|
|
131
129
|
});
|
|
130
|
+
if ((_a = response.usage.input_tokens_details) === null || _a === void 0 ? void 0 : _a.cached_tokens) {
|
|
131
|
+
span.setAttribute("gen_ai.usage.cached_input_tokens", response.usage.input_tokens_details.cached_tokens);
|
|
132
|
+
}
|
|
133
|
+
if ((_b = response.usage.output_tokens_details) === null || _b === void 0 ? void 0 : _b.reasoning_tokens) {
|
|
134
|
+
span.setAttribute("gen_ai.usage.reasoning_output_tokens", response.usage.output_tokens_details.reasoning_tokens);
|
|
135
|
+
}
|
|
132
136
|
}
|
|
133
137
|
span.setStatus({ code: api_1.SpanStatusCode.OK });
|
|
134
138
|
return response;
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.0.8-
|
|
1
|
+
export declare const SDK_VERSION = "0.0.8-alpha1";
|
package/dist/cjs/version.js
CHANGED
|
@@ -95,7 +95,6 @@ class ResponsesWrapper {
|
|
|
95
95
|
}
|
|
96
96
|
create(params) {
|
|
97
97
|
return __awaiter(this, void 0, void 0, function* () {
|
|
98
|
-
var _a;
|
|
99
98
|
const currentSpan = trace.getSpan(context.active());
|
|
100
99
|
if (!currentSpan) {
|
|
101
100
|
console.warn("No active span found, calling OpenAI directly without tracing.");
|
|
@@ -103,9 +102,8 @@ class ResponsesWrapper {
|
|
|
103
102
|
}
|
|
104
103
|
const externalCustomerId = getCustomerId();
|
|
105
104
|
const token = getTokenStorage();
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
return this.tracer.startActiveSpan(spanName, (span) => __awaiter(this, void 0, void 0, function* () {
|
|
105
|
+
return this.tracer.startActiveSpan("trace.openai.responses", (span) => __awaiter(this, void 0, void 0, function* () {
|
|
106
|
+
var _a, _b;
|
|
109
107
|
const attributes = {
|
|
110
108
|
"gen_ai.system": "openai",
|
|
111
109
|
"gen_ai.operation.name": "chat", // Equivalent to chat.completions
|
|
@@ -121,10 +119,16 @@ class ResponsesWrapper {
|
|
|
121
119
|
const response = yield this.openai.responses.create(params);
|
|
122
120
|
if (response.usage) {
|
|
123
121
|
span.setAttributes({
|
|
124
|
-
"gen_ai.usage.input_tokens": response.usage.
|
|
125
|
-
"gen_ai.usage.output_tokens": response.usage.
|
|
122
|
+
"gen_ai.usage.input_tokens": response.usage.input_tokens,
|
|
123
|
+
"gen_ai.usage.output_tokens": response.usage.output_tokens,
|
|
126
124
|
"gen_ai.response.model": response.model,
|
|
127
125
|
});
|
|
126
|
+
if ((_a = response.usage.input_tokens_details) === null || _a === void 0 ? void 0 : _a.cached_tokens) {
|
|
127
|
+
span.setAttribute("gen_ai.usage.cached_input_tokens", response.usage.input_tokens_details.cached_tokens);
|
|
128
|
+
}
|
|
129
|
+
if ((_b = response.usage.output_tokens_details) === null || _b === void 0 ? void 0 : _b.reasoning_tokens) {
|
|
130
|
+
span.setAttribute("gen_ai.usage.reasoning_output_tokens", response.usage.output_tokens_details.reasoning_tokens);
|
|
131
|
+
}
|
|
128
132
|
}
|
|
129
133
|
span.setStatus({ code: SpanStatusCode.OK });
|
|
130
134
|
return response;
|
package/dist/esm/version.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.0.8-
|
|
1
|
+
export declare const SDK_VERSION = "0.0.8-alpha1";
|
package/dist/esm/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "0.0.8-
|
|
1
|
+
export const SDK_VERSION = "0.0.8-alpha1";
|