raindrop-ai 0.0.51 → 0.0.52
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 +2 -2
- package/dist/index.mjs +2 -2
- package/dist/tracing/index.js +133 -125
- package/dist/tracing/index.mjs +133 -125
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -7961,7 +7961,7 @@ var CategorizationRequestSchema = import_zod.z.object({
|
|
|
7961
7961
|
// package.json
|
|
7962
7962
|
var package_default = {
|
|
7963
7963
|
name: "raindrop-ai",
|
|
7964
|
-
version: "0.0.
|
|
7964
|
+
version: "0.0.52",
|
|
7965
7965
|
main: "dist/index.js",
|
|
7966
7966
|
module: "dist/index.mjs",
|
|
7967
7967
|
types: "dist/index.d.ts",
|
|
@@ -8001,7 +8001,7 @@ var package_default = {
|
|
|
8001
8001
|
zod: "^3.23.8"
|
|
8002
8002
|
},
|
|
8003
8003
|
optionalDependencies: {
|
|
8004
|
-
"@traceloop/node-server-sdk": "^0.14.
|
|
8004
|
+
"@traceloop/node-server-sdk": "^0.14.3"
|
|
8005
8005
|
},
|
|
8006
8006
|
publishConfig: {
|
|
8007
8007
|
access: "public"
|
package/dist/index.mjs
CHANGED
|
@@ -84,7 +84,7 @@ var CategorizationRequestSchema = z.object({
|
|
|
84
84
|
// package.json
|
|
85
85
|
var package_default = {
|
|
86
86
|
name: "raindrop-ai",
|
|
87
|
-
version: "0.0.
|
|
87
|
+
version: "0.0.52",
|
|
88
88
|
main: "dist/index.js",
|
|
89
89
|
module: "dist/index.mjs",
|
|
90
90
|
types: "dist/index.d.ts",
|
|
@@ -124,7 +124,7 @@ var package_default = {
|
|
|
124
124
|
zod: "^3.23.8"
|
|
125
125
|
},
|
|
126
126
|
optionalDependencies: {
|
|
127
|
-
"@traceloop/node-server-sdk": "^0.14.
|
|
127
|
+
"@traceloop/node-server-sdk": "^0.14.3"
|
|
128
128
|
},
|
|
129
129
|
publishConfig: {
|
|
130
130
|
access: "public"
|
package/dist/tracing/index.js
CHANGED
|
@@ -111983,6 +111983,125 @@ var require_node_ponyfill = __commonJS({
|
|
|
111983
111983
|
}
|
|
111984
111984
|
});
|
|
111985
111985
|
|
|
111986
|
+
// ../../node_modules/fetch-retry/index.js
|
|
111987
|
+
var require_fetch_retry = __commonJS({
|
|
111988
|
+
"../../node_modules/fetch-retry/index.js"(exports2, module2) {
|
|
111989
|
+
"use strict";
|
|
111990
|
+
module2.exports = function(fetch3, defaults) {
|
|
111991
|
+
defaults = defaults || {};
|
|
111992
|
+
if (typeof fetch3 !== "function") {
|
|
111993
|
+
throw new ArgumentError("fetch must be a function");
|
|
111994
|
+
}
|
|
111995
|
+
if (typeof defaults !== "object") {
|
|
111996
|
+
throw new ArgumentError("defaults must be an object");
|
|
111997
|
+
}
|
|
111998
|
+
if (defaults.retries !== void 0 && !isPositiveInteger(defaults.retries)) {
|
|
111999
|
+
throw new ArgumentError("retries must be a positive integer");
|
|
112000
|
+
}
|
|
112001
|
+
if (defaults.retryDelay !== void 0 && !isPositiveInteger(defaults.retryDelay) && typeof defaults.retryDelay !== "function") {
|
|
112002
|
+
throw new ArgumentError("retryDelay must be a positive integer or a function returning a positive integer");
|
|
112003
|
+
}
|
|
112004
|
+
if (defaults.retryOn !== void 0 && !Array.isArray(defaults.retryOn) && typeof defaults.retryOn !== "function") {
|
|
112005
|
+
throw new ArgumentError("retryOn property expects an array or function");
|
|
112006
|
+
}
|
|
112007
|
+
var baseDefaults = {
|
|
112008
|
+
retries: 3,
|
|
112009
|
+
retryDelay: 1e3,
|
|
112010
|
+
retryOn: []
|
|
112011
|
+
};
|
|
112012
|
+
defaults = Object.assign(baseDefaults, defaults);
|
|
112013
|
+
return function fetchRetry2(input, init) {
|
|
112014
|
+
var retries = defaults.retries;
|
|
112015
|
+
var retryDelay = defaults.retryDelay;
|
|
112016
|
+
var retryOn = defaults.retryOn;
|
|
112017
|
+
if (init && init.retries !== void 0) {
|
|
112018
|
+
if (isPositiveInteger(init.retries)) {
|
|
112019
|
+
retries = init.retries;
|
|
112020
|
+
} else {
|
|
112021
|
+
throw new ArgumentError("retries must be a positive integer");
|
|
112022
|
+
}
|
|
112023
|
+
}
|
|
112024
|
+
if (init && init.retryDelay !== void 0) {
|
|
112025
|
+
if (isPositiveInteger(init.retryDelay) || typeof init.retryDelay === "function") {
|
|
112026
|
+
retryDelay = init.retryDelay;
|
|
112027
|
+
} else {
|
|
112028
|
+
throw new ArgumentError("retryDelay must be a positive integer or a function returning a positive integer");
|
|
112029
|
+
}
|
|
112030
|
+
}
|
|
112031
|
+
if (init && init.retryOn) {
|
|
112032
|
+
if (Array.isArray(init.retryOn) || typeof init.retryOn === "function") {
|
|
112033
|
+
retryOn = init.retryOn;
|
|
112034
|
+
} else {
|
|
112035
|
+
throw new ArgumentError("retryOn property expects an array or function");
|
|
112036
|
+
}
|
|
112037
|
+
}
|
|
112038
|
+
return new Promise(function(resolve, reject) {
|
|
112039
|
+
var wrappedFetch = function(attempt) {
|
|
112040
|
+
var _input = typeof Request !== "undefined" && input instanceof Request ? input.clone() : input;
|
|
112041
|
+
fetch3(_input, init).then(function(response) {
|
|
112042
|
+
if (Array.isArray(retryOn) && retryOn.indexOf(response.status) === -1) {
|
|
112043
|
+
resolve(response);
|
|
112044
|
+
} else if (typeof retryOn === "function") {
|
|
112045
|
+
try {
|
|
112046
|
+
return Promise.resolve(retryOn(attempt, null, response)).then(function(retryOnResponse) {
|
|
112047
|
+
if (retryOnResponse) {
|
|
112048
|
+
retry(attempt, null, response);
|
|
112049
|
+
} else {
|
|
112050
|
+
resolve(response);
|
|
112051
|
+
}
|
|
112052
|
+
}).catch(reject);
|
|
112053
|
+
} catch (error) {
|
|
112054
|
+
reject(error);
|
|
112055
|
+
}
|
|
112056
|
+
} else {
|
|
112057
|
+
if (attempt < retries) {
|
|
112058
|
+
retry(attempt, null, response);
|
|
112059
|
+
} else {
|
|
112060
|
+
resolve(response);
|
|
112061
|
+
}
|
|
112062
|
+
}
|
|
112063
|
+
}).catch(function(error) {
|
|
112064
|
+
if (typeof retryOn === "function") {
|
|
112065
|
+
try {
|
|
112066
|
+
Promise.resolve(retryOn(attempt, error, null)).then(function(retryOnResponse) {
|
|
112067
|
+
if (retryOnResponse) {
|
|
112068
|
+
retry(attempt, error, null);
|
|
112069
|
+
} else {
|
|
112070
|
+
reject(error);
|
|
112071
|
+
}
|
|
112072
|
+
}).catch(function(error2) {
|
|
112073
|
+
reject(error2);
|
|
112074
|
+
});
|
|
112075
|
+
} catch (error2) {
|
|
112076
|
+
reject(error2);
|
|
112077
|
+
}
|
|
112078
|
+
} else if (attempt < retries) {
|
|
112079
|
+
retry(attempt, error, null);
|
|
112080
|
+
} else {
|
|
112081
|
+
reject(error);
|
|
112082
|
+
}
|
|
112083
|
+
});
|
|
112084
|
+
};
|
|
112085
|
+
function retry(attempt, error, response) {
|
|
112086
|
+
var delay = typeof retryDelay === "function" ? retryDelay(attempt, error, response) : retryDelay;
|
|
112087
|
+
setTimeout(function() {
|
|
112088
|
+
wrappedFetch(++attempt);
|
|
112089
|
+
}, delay);
|
|
112090
|
+
}
|
|
112091
|
+
wrappedFetch(0);
|
|
112092
|
+
});
|
|
112093
|
+
};
|
|
112094
|
+
};
|
|
112095
|
+
function isPositiveInteger(value) {
|
|
112096
|
+
return Number.isInteger(value) && value >= 0;
|
|
112097
|
+
}
|
|
112098
|
+
function ArgumentError(message) {
|
|
112099
|
+
this.name = "ArgumentError";
|
|
112100
|
+
this.message = message;
|
|
112101
|
+
}
|
|
112102
|
+
}
|
|
112103
|
+
});
|
|
112104
|
+
|
|
111986
112105
|
// ../../node_modules/@traceloop/node-server-sdk/node_modules/@traceloop/ai-semantic-conventions/dist/src/SemanticAttributes.js
|
|
111987
112106
|
var require_SemanticAttributes = __commonJS({
|
|
111988
112107
|
"../../node_modules/@traceloop/node-server-sdk/node_modules/@traceloop/ai-semantic-conventions/dist/src/SemanticAttributes.js"(exports2) {
|
|
@@ -129845,125 +129964,6 @@ var require_nunjucks = __commonJS({
|
|
|
129845
129964
|
}
|
|
129846
129965
|
});
|
|
129847
129966
|
|
|
129848
|
-
// ../../node_modules/fetch-retry/index.js
|
|
129849
|
-
var require_fetch_retry = __commonJS({
|
|
129850
|
-
"../../node_modules/fetch-retry/index.js"(exports2, module2) {
|
|
129851
|
-
"use strict";
|
|
129852
|
-
module2.exports = function(fetch3, defaults) {
|
|
129853
|
-
defaults = defaults || {};
|
|
129854
|
-
if (typeof fetch3 !== "function") {
|
|
129855
|
-
throw new ArgumentError("fetch must be a function");
|
|
129856
|
-
}
|
|
129857
|
-
if (typeof defaults !== "object") {
|
|
129858
|
-
throw new ArgumentError("defaults must be an object");
|
|
129859
|
-
}
|
|
129860
|
-
if (defaults.retries !== void 0 && !isPositiveInteger(defaults.retries)) {
|
|
129861
|
-
throw new ArgumentError("retries must be a positive integer");
|
|
129862
|
-
}
|
|
129863
|
-
if (defaults.retryDelay !== void 0 && !isPositiveInteger(defaults.retryDelay) && typeof defaults.retryDelay !== "function") {
|
|
129864
|
-
throw new ArgumentError("retryDelay must be a positive integer or a function returning a positive integer");
|
|
129865
|
-
}
|
|
129866
|
-
if (defaults.retryOn !== void 0 && !Array.isArray(defaults.retryOn) && typeof defaults.retryOn !== "function") {
|
|
129867
|
-
throw new ArgumentError("retryOn property expects an array or function");
|
|
129868
|
-
}
|
|
129869
|
-
var baseDefaults = {
|
|
129870
|
-
retries: 3,
|
|
129871
|
-
retryDelay: 1e3,
|
|
129872
|
-
retryOn: []
|
|
129873
|
-
};
|
|
129874
|
-
defaults = Object.assign(baseDefaults, defaults);
|
|
129875
|
-
return function fetchRetry2(input, init) {
|
|
129876
|
-
var retries = defaults.retries;
|
|
129877
|
-
var retryDelay = defaults.retryDelay;
|
|
129878
|
-
var retryOn = defaults.retryOn;
|
|
129879
|
-
if (init && init.retries !== void 0) {
|
|
129880
|
-
if (isPositiveInteger(init.retries)) {
|
|
129881
|
-
retries = init.retries;
|
|
129882
|
-
} else {
|
|
129883
|
-
throw new ArgumentError("retries must be a positive integer");
|
|
129884
|
-
}
|
|
129885
|
-
}
|
|
129886
|
-
if (init && init.retryDelay !== void 0) {
|
|
129887
|
-
if (isPositiveInteger(init.retryDelay) || typeof init.retryDelay === "function") {
|
|
129888
|
-
retryDelay = init.retryDelay;
|
|
129889
|
-
} else {
|
|
129890
|
-
throw new ArgumentError("retryDelay must be a positive integer or a function returning a positive integer");
|
|
129891
|
-
}
|
|
129892
|
-
}
|
|
129893
|
-
if (init && init.retryOn) {
|
|
129894
|
-
if (Array.isArray(init.retryOn) || typeof init.retryOn === "function") {
|
|
129895
|
-
retryOn = init.retryOn;
|
|
129896
|
-
} else {
|
|
129897
|
-
throw new ArgumentError("retryOn property expects an array or function");
|
|
129898
|
-
}
|
|
129899
|
-
}
|
|
129900
|
-
return new Promise(function(resolve, reject) {
|
|
129901
|
-
var wrappedFetch = function(attempt) {
|
|
129902
|
-
var _input = typeof Request !== "undefined" && input instanceof Request ? input.clone() : input;
|
|
129903
|
-
fetch3(_input, init).then(function(response) {
|
|
129904
|
-
if (Array.isArray(retryOn) && retryOn.indexOf(response.status) === -1) {
|
|
129905
|
-
resolve(response);
|
|
129906
|
-
} else if (typeof retryOn === "function") {
|
|
129907
|
-
try {
|
|
129908
|
-
return Promise.resolve(retryOn(attempt, null, response)).then(function(retryOnResponse) {
|
|
129909
|
-
if (retryOnResponse) {
|
|
129910
|
-
retry(attempt, null, response);
|
|
129911
|
-
} else {
|
|
129912
|
-
resolve(response);
|
|
129913
|
-
}
|
|
129914
|
-
}).catch(reject);
|
|
129915
|
-
} catch (error) {
|
|
129916
|
-
reject(error);
|
|
129917
|
-
}
|
|
129918
|
-
} else {
|
|
129919
|
-
if (attempt < retries) {
|
|
129920
|
-
retry(attempt, null, response);
|
|
129921
|
-
} else {
|
|
129922
|
-
resolve(response);
|
|
129923
|
-
}
|
|
129924
|
-
}
|
|
129925
|
-
}).catch(function(error) {
|
|
129926
|
-
if (typeof retryOn === "function") {
|
|
129927
|
-
try {
|
|
129928
|
-
Promise.resolve(retryOn(attempt, error, null)).then(function(retryOnResponse) {
|
|
129929
|
-
if (retryOnResponse) {
|
|
129930
|
-
retry(attempt, error, null);
|
|
129931
|
-
} else {
|
|
129932
|
-
reject(error);
|
|
129933
|
-
}
|
|
129934
|
-
}).catch(function(error2) {
|
|
129935
|
-
reject(error2);
|
|
129936
|
-
});
|
|
129937
|
-
} catch (error2) {
|
|
129938
|
-
reject(error2);
|
|
129939
|
-
}
|
|
129940
|
-
} else if (attempt < retries) {
|
|
129941
|
-
retry(attempt, error, null);
|
|
129942
|
-
} else {
|
|
129943
|
-
reject(error);
|
|
129944
|
-
}
|
|
129945
|
-
});
|
|
129946
|
-
};
|
|
129947
|
-
function retry(attempt, error, response) {
|
|
129948
|
-
var delay = typeof retryDelay === "function" ? retryDelay(attempt, error, response) : retryDelay;
|
|
129949
|
-
setTimeout(function() {
|
|
129950
|
-
wrappedFetch(++attempt);
|
|
129951
|
-
}, delay);
|
|
129952
|
-
}
|
|
129953
|
-
wrappedFetch(0);
|
|
129954
|
-
});
|
|
129955
|
-
};
|
|
129956
|
-
};
|
|
129957
|
-
function isPositiveInteger(value) {
|
|
129958
|
-
return Number.isInteger(value) && value >= 0;
|
|
129959
|
-
}
|
|
129960
|
-
function ArgumentError(message) {
|
|
129961
|
-
this.name = "ArgumentError";
|
|
129962
|
-
this.message = message;
|
|
129963
|
-
}
|
|
129964
|
-
}
|
|
129965
|
-
});
|
|
129966
|
-
|
|
129967
129967
|
// src/tracing/index.ts
|
|
129968
129968
|
var tracing_exports = {};
|
|
129969
129969
|
__export(tracing_exports, {
|
|
@@ -133195,6 +133195,7 @@ var PostHogSentryIntegration = (
|
|
|
133195
133195
|
|
|
133196
133196
|
// ../../node_modules/@traceloop/node-server-sdk/dist/index.mjs
|
|
133197
133197
|
var import_cross_fetch = __toESM(require_node_ponyfill(), 1);
|
|
133198
|
+
var import_fetch_retry = __toESM(require_fetch_retry(), 1);
|
|
133198
133199
|
var import_ai_semantic_conventions12 = __toESM(require_src12(), 1);
|
|
133199
133200
|
|
|
133200
133201
|
// ../../node_modules/tslib/tslib.es6.mjs
|
|
@@ -134133,7 +134134,7 @@ var InstrumentationNodeModuleDefinition2 = (
|
|
|
134133
134134
|
|
|
134134
134135
|
// ../../node_modules/@traceloop/instrumentation-anthropic/dist/index.mjs
|
|
134135
134136
|
var import_ai_semantic_conventions = __toESM(require_src13(), 1);
|
|
134136
|
-
var version2 = "0.14.
|
|
134137
|
+
var version2 = "0.14.3";
|
|
134137
134138
|
var AnthropicInstrumentation = class extends InstrumentationBase2 {
|
|
134138
134139
|
constructor(config = {}) {
|
|
134139
134140
|
super("@traceloop/instrumentation-anthropic", version2, config);
|
|
@@ -134221,12 +134222,19 @@ var AnthropicInstrumentation = class extends InstrumentationBase2 {
|
|
|
134221
134222
|
}
|
|
134222
134223
|
if (this._shouldSendPrompts()) {
|
|
134223
134224
|
if (type === "chat") {
|
|
134225
|
+
let promptIndex = 0;
|
|
134226
|
+
if ("system" in params && params.system !== void 0) {
|
|
134227
|
+
attributes[`${import_ai_semantic_conventions.SpanAttributes.LLM_PROMPTS}.0.role`] = "system";
|
|
134228
|
+
attributes[`${import_ai_semantic_conventions.SpanAttributes.LLM_PROMPTS}.0.content`] = typeof params.system === "string" ? params.system : JSON.stringify(params.system);
|
|
134229
|
+
promptIndex += 1;
|
|
134230
|
+
}
|
|
134224
134231
|
params.messages.forEach((message, index) => {
|
|
134225
|
-
|
|
134232
|
+
const currentIndex = index + promptIndex;
|
|
134233
|
+
attributes[`${import_ai_semantic_conventions.SpanAttributes.LLM_PROMPTS}.${currentIndex}.role`] = message.role;
|
|
134226
134234
|
if (typeof message.content === "string") {
|
|
134227
|
-
attributes[`${import_ai_semantic_conventions.SpanAttributes.LLM_PROMPTS}.${
|
|
134235
|
+
attributes[`${import_ai_semantic_conventions.SpanAttributes.LLM_PROMPTS}.${currentIndex}.content`] = message.content || "";
|
|
134228
134236
|
} else {
|
|
134229
|
-
attributes[`${import_ai_semantic_conventions.SpanAttributes.LLM_PROMPTS}.${
|
|
134237
|
+
attributes[`${import_ai_semantic_conventions.SpanAttributes.LLM_PROMPTS}.${currentIndex}.content`] = JSON.stringify(message.content);
|
|
134230
134238
|
}
|
|
134231
134239
|
});
|
|
134232
134240
|
} else {
|
|
@@ -146646,7 +146654,7 @@ var TogetherInstrumentation = class extends InstrumentationBase13 {
|
|
|
146646
146654
|
// ../../node_modules/@traceloop/node-server-sdk/dist/index.mjs
|
|
146647
146655
|
var import_sdk_trace_node = __toESM(require_src2(), 1);
|
|
146648
146656
|
var import_nunjucks = __toESM(require_nunjucks(), 1);
|
|
146649
|
-
var version14 = "0.14.
|
|
146657
|
+
var version14 = "0.14.3";
|
|
146650
146658
|
var Telemetry = class _Telemetry {
|
|
146651
146659
|
static getInstance() {
|
|
146652
146660
|
if (!_Telemetry.instance) {
|
|
@@ -146739,7 +146747,7 @@ var validateConfiguration = (options) => {
|
|
|
146739
146747
|
}
|
|
146740
146748
|
}
|
|
146741
146749
|
};
|
|
146742
|
-
var fetchRetry =
|
|
146750
|
+
var fetchRetry = (0, import_fetch_retry.default)(import_cross_fetch.default);
|
|
146743
146751
|
var fetchPrompts = async (options) => {
|
|
146744
146752
|
const { apiKey, baseUrl, traceloopSyncMaxRetries } = options;
|
|
146745
146753
|
const response = await fetchRetry(`${baseUrl}/v1/traceloop/prompts`, {
|
package/dist/tracing/index.mjs
CHANGED
|
@@ -104129,6 +104129,125 @@ var require_node_ponyfill = __commonJS({
|
|
|
104129
104129
|
}
|
|
104130
104130
|
});
|
|
104131
104131
|
|
|
104132
|
+
// ../../node_modules/fetch-retry/index.js
|
|
104133
|
+
var require_fetch_retry = __commonJS({
|
|
104134
|
+
"../../node_modules/fetch-retry/index.js"(exports2, module2) {
|
|
104135
|
+
"use strict";
|
|
104136
|
+
module2.exports = function(fetch3, defaults) {
|
|
104137
|
+
defaults = defaults || {};
|
|
104138
|
+
if (typeof fetch3 !== "function") {
|
|
104139
|
+
throw new ArgumentError("fetch must be a function");
|
|
104140
|
+
}
|
|
104141
|
+
if (typeof defaults !== "object") {
|
|
104142
|
+
throw new ArgumentError("defaults must be an object");
|
|
104143
|
+
}
|
|
104144
|
+
if (defaults.retries !== void 0 && !isPositiveInteger(defaults.retries)) {
|
|
104145
|
+
throw new ArgumentError("retries must be a positive integer");
|
|
104146
|
+
}
|
|
104147
|
+
if (defaults.retryDelay !== void 0 && !isPositiveInteger(defaults.retryDelay) && typeof defaults.retryDelay !== "function") {
|
|
104148
|
+
throw new ArgumentError("retryDelay must be a positive integer or a function returning a positive integer");
|
|
104149
|
+
}
|
|
104150
|
+
if (defaults.retryOn !== void 0 && !Array.isArray(defaults.retryOn) && typeof defaults.retryOn !== "function") {
|
|
104151
|
+
throw new ArgumentError("retryOn property expects an array or function");
|
|
104152
|
+
}
|
|
104153
|
+
var baseDefaults = {
|
|
104154
|
+
retries: 3,
|
|
104155
|
+
retryDelay: 1e3,
|
|
104156
|
+
retryOn: []
|
|
104157
|
+
};
|
|
104158
|
+
defaults = Object.assign(baseDefaults, defaults);
|
|
104159
|
+
return function fetchRetry2(input, init) {
|
|
104160
|
+
var retries = defaults.retries;
|
|
104161
|
+
var retryDelay = defaults.retryDelay;
|
|
104162
|
+
var retryOn = defaults.retryOn;
|
|
104163
|
+
if (init && init.retries !== void 0) {
|
|
104164
|
+
if (isPositiveInteger(init.retries)) {
|
|
104165
|
+
retries = init.retries;
|
|
104166
|
+
} else {
|
|
104167
|
+
throw new ArgumentError("retries must be a positive integer");
|
|
104168
|
+
}
|
|
104169
|
+
}
|
|
104170
|
+
if (init && init.retryDelay !== void 0) {
|
|
104171
|
+
if (isPositiveInteger(init.retryDelay) || typeof init.retryDelay === "function") {
|
|
104172
|
+
retryDelay = init.retryDelay;
|
|
104173
|
+
} else {
|
|
104174
|
+
throw new ArgumentError("retryDelay must be a positive integer or a function returning a positive integer");
|
|
104175
|
+
}
|
|
104176
|
+
}
|
|
104177
|
+
if (init && init.retryOn) {
|
|
104178
|
+
if (Array.isArray(init.retryOn) || typeof init.retryOn === "function") {
|
|
104179
|
+
retryOn = init.retryOn;
|
|
104180
|
+
} else {
|
|
104181
|
+
throw new ArgumentError("retryOn property expects an array or function");
|
|
104182
|
+
}
|
|
104183
|
+
}
|
|
104184
|
+
return new Promise(function(resolve, reject) {
|
|
104185
|
+
var wrappedFetch = function(attempt) {
|
|
104186
|
+
var _input = typeof Request !== "undefined" && input instanceof Request ? input.clone() : input;
|
|
104187
|
+
fetch3(_input, init).then(function(response) {
|
|
104188
|
+
if (Array.isArray(retryOn) && retryOn.indexOf(response.status) === -1) {
|
|
104189
|
+
resolve(response);
|
|
104190
|
+
} else if (typeof retryOn === "function") {
|
|
104191
|
+
try {
|
|
104192
|
+
return Promise.resolve(retryOn(attempt, null, response)).then(function(retryOnResponse) {
|
|
104193
|
+
if (retryOnResponse) {
|
|
104194
|
+
retry(attempt, null, response);
|
|
104195
|
+
} else {
|
|
104196
|
+
resolve(response);
|
|
104197
|
+
}
|
|
104198
|
+
}).catch(reject);
|
|
104199
|
+
} catch (error) {
|
|
104200
|
+
reject(error);
|
|
104201
|
+
}
|
|
104202
|
+
} else {
|
|
104203
|
+
if (attempt < retries) {
|
|
104204
|
+
retry(attempt, null, response);
|
|
104205
|
+
} else {
|
|
104206
|
+
resolve(response);
|
|
104207
|
+
}
|
|
104208
|
+
}
|
|
104209
|
+
}).catch(function(error) {
|
|
104210
|
+
if (typeof retryOn === "function") {
|
|
104211
|
+
try {
|
|
104212
|
+
Promise.resolve(retryOn(attempt, error, null)).then(function(retryOnResponse) {
|
|
104213
|
+
if (retryOnResponse) {
|
|
104214
|
+
retry(attempt, error, null);
|
|
104215
|
+
} else {
|
|
104216
|
+
reject(error);
|
|
104217
|
+
}
|
|
104218
|
+
}).catch(function(error2) {
|
|
104219
|
+
reject(error2);
|
|
104220
|
+
});
|
|
104221
|
+
} catch (error2) {
|
|
104222
|
+
reject(error2);
|
|
104223
|
+
}
|
|
104224
|
+
} else if (attempt < retries) {
|
|
104225
|
+
retry(attempt, error, null);
|
|
104226
|
+
} else {
|
|
104227
|
+
reject(error);
|
|
104228
|
+
}
|
|
104229
|
+
});
|
|
104230
|
+
};
|
|
104231
|
+
function retry(attempt, error, response) {
|
|
104232
|
+
var delay = typeof retryDelay === "function" ? retryDelay(attempt, error, response) : retryDelay;
|
|
104233
|
+
setTimeout(function() {
|
|
104234
|
+
wrappedFetch(++attempt);
|
|
104235
|
+
}, delay);
|
|
104236
|
+
}
|
|
104237
|
+
wrappedFetch(0);
|
|
104238
|
+
});
|
|
104239
|
+
};
|
|
104240
|
+
};
|
|
104241
|
+
function isPositiveInteger(value) {
|
|
104242
|
+
return Number.isInteger(value) && value >= 0;
|
|
104243
|
+
}
|
|
104244
|
+
function ArgumentError(message) {
|
|
104245
|
+
this.name = "ArgumentError";
|
|
104246
|
+
this.message = message;
|
|
104247
|
+
}
|
|
104248
|
+
}
|
|
104249
|
+
});
|
|
104250
|
+
|
|
104132
104251
|
// ../../node_modules/@traceloop/node-server-sdk/node_modules/@traceloop/ai-semantic-conventions/dist/src/SemanticAttributes.js
|
|
104133
104252
|
var require_SemanticAttributes = __commonJS({
|
|
104134
104253
|
"../../node_modules/@traceloop/node-server-sdk/node_modules/@traceloop/ai-semantic-conventions/dist/src/SemanticAttributes.js"(exports2) {
|
|
@@ -121991,125 +122110,6 @@ var require_nunjucks = __commonJS({
|
|
|
121991
122110
|
}
|
|
121992
122111
|
});
|
|
121993
122112
|
|
|
121994
|
-
// ../../node_modules/fetch-retry/index.js
|
|
121995
|
-
var require_fetch_retry = __commonJS({
|
|
121996
|
-
"../../node_modules/fetch-retry/index.js"(exports2, module2) {
|
|
121997
|
-
"use strict";
|
|
121998
|
-
module2.exports = function(fetch3, defaults) {
|
|
121999
|
-
defaults = defaults || {};
|
|
122000
|
-
if (typeof fetch3 !== "function") {
|
|
122001
|
-
throw new ArgumentError("fetch must be a function");
|
|
122002
|
-
}
|
|
122003
|
-
if (typeof defaults !== "object") {
|
|
122004
|
-
throw new ArgumentError("defaults must be an object");
|
|
122005
|
-
}
|
|
122006
|
-
if (defaults.retries !== void 0 && !isPositiveInteger(defaults.retries)) {
|
|
122007
|
-
throw new ArgumentError("retries must be a positive integer");
|
|
122008
|
-
}
|
|
122009
|
-
if (defaults.retryDelay !== void 0 && !isPositiveInteger(defaults.retryDelay) && typeof defaults.retryDelay !== "function") {
|
|
122010
|
-
throw new ArgumentError("retryDelay must be a positive integer or a function returning a positive integer");
|
|
122011
|
-
}
|
|
122012
|
-
if (defaults.retryOn !== void 0 && !Array.isArray(defaults.retryOn) && typeof defaults.retryOn !== "function") {
|
|
122013
|
-
throw new ArgumentError("retryOn property expects an array or function");
|
|
122014
|
-
}
|
|
122015
|
-
var baseDefaults = {
|
|
122016
|
-
retries: 3,
|
|
122017
|
-
retryDelay: 1e3,
|
|
122018
|
-
retryOn: []
|
|
122019
|
-
};
|
|
122020
|
-
defaults = Object.assign(baseDefaults, defaults);
|
|
122021
|
-
return function fetchRetry2(input, init) {
|
|
122022
|
-
var retries = defaults.retries;
|
|
122023
|
-
var retryDelay = defaults.retryDelay;
|
|
122024
|
-
var retryOn = defaults.retryOn;
|
|
122025
|
-
if (init && init.retries !== void 0) {
|
|
122026
|
-
if (isPositiveInteger(init.retries)) {
|
|
122027
|
-
retries = init.retries;
|
|
122028
|
-
} else {
|
|
122029
|
-
throw new ArgumentError("retries must be a positive integer");
|
|
122030
|
-
}
|
|
122031
|
-
}
|
|
122032
|
-
if (init && init.retryDelay !== void 0) {
|
|
122033
|
-
if (isPositiveInteger(init.retryDelay) || typeof init.retryDelay === "function") {
|
|
122034
|
-
retryDelay = init.retryDelay;
|
|
122035
|
-
} else {
|
|
122036
|
-
throw new ArgumentError("retryDelay must be a positive integer or a function returning a positive integer");
|
|
122037
|
-
}
|
|
122038
|
-
}
|
|
122039
|
-
if (init && init.retryOn) {
|
|
122040
|
-
if (Array.isArray(init.retryOn) || typeof init.retryOn === "function") {
|
|
122041
|
-
retryOn = init.retryOn;
|
|
122042
|
-
} else {
|
|
122043
|
-
throw new ArgumentError("retryOn property expects an array or function");
|
|
122044
|
-
}
|
|
122045
|
-
}
|
|
122046
|
-
return new Promise(function(resolve, reject) {
|
|
122047
|
-
var wrappedFetch = function(attempt) {
|
|
122048
|
-
var _input = typeof Request !== "undefined" && input instanceof Request ? input.clone() : input;
|
|
122049
|
-
fetch3(_input, init).then(function(response) {
|
|
122050
|
-
if (Array.isArray(retryOn) && retryOn.indexOf(response.status) === -1) {
|
|
122051
|
-
resolve(response);
|
|
122052
|
-
} else if (typeof retryOn === "function") {
|
|
122053
|
-
try {
|
|
122054
|
-
return Promise.resolve(retryOn(attempt, null, response)).then(function(retryOnResponse) {
|
|
122055
|
-
if (retryOnResponse) {
|
|
122056
|
-
retry(attempt, null, response);
|
|
122057
|
-
} else {
|
|
122058
|
-
resolve(response);
|
|
122059
|
-
}
|
|
122060
|
-
}).catch(reject);
|
|
122061
|
-
} catch (error) {
|
|
122062
|
-
reject(error);
|
|
122063
|
-
}
|
|
122064
|
-
} else {
|
|
122065
|
-
if (attempt < retries) {
|
|
122066
|
-
retry(attempt, null, response);
|
|
122067
|
-
} else {
|
|
122068
|
-
resolve(response);
|
|
122069
|
-
}
|
|
122070
|
-
}
|
|
122071
|
-
}).catch(function(error) {
|
|
122072
|
-
if (typeof retryOn === "function") {
|
|
122073
|
-
try {
|
|
122074
|
-
Promise.resolve(retryOn(attempt, error, null)).then(function(retryOnResponse) {
|
|
122075
|
-
if (retryOnResponse) {
|
|
122076
|
-
retry(attempt, error, null);
|
|
122077
|
-
} else {
|
|
122078
|
-
reject(error);
|
|
122079
|
-
}
|
|
122080
|
-
}).catch(function(error2) {
|
|
122081
|
-
reject(error2);
|
|
122082
|
-
});
|
|
122083
|
-
} catch (error2) {
|
|
122084
|
-
reject(error2);
|
|
122085
|
-
}
|
|
122086
|
-
} else if (attempt < retries) {
|
|
122087
|
-
retry(attempt, error, null);
|
|
122088
|
-
} else {
|
|
122089
|
-
reject(error);
|
|
122090
|
-
}
|
|
122091
|
-
});
|
|
122092
|
-
};
|
|
122093
|
-
function retry(attempt, error, response) {
|
|
122094
|
-
var delay = typeof retryDelay === "function" ? retryDelay(attempt, error, response) : retryDelay;
|
|
122095
|
-
setTimeout(function() {
|
|
122096
|
-
wrappedFetch(++attempt);
|
|
122097
|
-
}, delay);
|
|
122098
|
-
}
|
|
122099
|
-
wrappedFetch(0);
|
|
122100
|
-
});
|
|
122101
|
-
};
|
|
122102
|
-
};
|
|
122103
|
-
function isPositiveInteger(value) {
|
|
122104
|
-
return Number.isInteger(value) && value >= 0;
|
|
122105
|
-
}
|
|
122106
|
-
function ArgumentError(message) {
|
|
122107
|
-
this.name = "ArgumentError";
|
|
122108
|
-
this.message = message;
|
|
122109
|
-
}
|
|
122110
|
-
}
|
|
122111
|
-
});
|
|
122112
|
-
|
|
122113
122113
|
// src/tracing/index.ts
|
|
122114
122114
|
init_esm();
|
|
122115
122115
|
|
|
@@ -125335,6 +125335,7 @@ var PostHogSentryIntegration = (
|
|
|
125335
125335
|
|
|
125336
125336
|
// ../../node_modules/@traceloop/node-server-sdk/dist/index.mjs
|
|
125337
125337
|
var import_cross_fetch = __toESM(require_node_ponyfill(), 1);
|
|
125338
|
+
var import_fetch_retry = __toESM(require_fetch_retry(), 1);
|
|
125338
125339
|
var import_ai_semantic_conventions12 = __toESM(require_src11(), 1);
|
|
125339
125340
|
|
|
125340
125341
|
// ../../node_modules/tslib/tslib.es6.mjs
|
|
@@ -126273,7 +126274,7 @@ var InstrumentationNodeModuleDefinition2 = (
|
|
|
126273
126274
|
|
|
126274
126275
|
// ../../node_modules/@traceloop/instrumentation-anthropic/dist/index.mjs
|
|
126275
126276
|
var import_ai_semantic_conventions = __toESM(require_src12(), 1);
|
|
126276
|
-
var version2 = "0.14.
|
|
126277
|
+
var version2 = "0.14.3";
|
|
126277
126278
|
var AnthropicInstrumentation = class extends InstrumentationBase2 {
|
|
126278
126279
|
constructor(config = {}) {
|
|
126279
126280
|
super("@traceloop/instrumentation-anthropic", version2, config);
|
|
@@ -126361,12 +126362,19 @@ var AnthropicInstrumentation = class extends InstrumentationBase2 {
|
|
|
126361
126362
|
}
|
|
126362
126363
|
if (this._shouldSendPrompts()) {
|
|
126363
126364
|
if (type === "chat") {
|
|
126365
|
+
let promptIndex = 0;
|
|
126366
|
+
if ("system" in params && params.system !== void 0) {
|
|
126367
|
+
attributes[`${import_ai_semantic_conventions.SpanAttributes.LLM_PROMPTS}.0.role`] = "system";
|
|
126368
|
+
attributes[`${import_ai_semantic_conventions.SpanAttributes.LLM_PROMPTS}.0.content`] = typeof params.system === "string" ? params.system : JSON.stringify(params.system);
|
|
126369
|
+
promptIndex += 1;
|
|
126370
|
+
}
|
|
126364
126371
|
params.messages.forEach((message, index) => {
|
|
126365
|
-
|
|
126372
|
+
const currentIndex = index + promptIndex;
|
|
126373
|
+
attributes[`${import_ai_semantic_conventions.SpanAttributes.LLM_PROMPTS}.${currentIndex}.role`] = message.role;
|
|
126366
126374
|
if (typeof message.content === "string") {
|
|
126367
|
-
attributes[`${import_ai_semantic_conventions.SpanAttributes.LLM_PROMPTS}.${
|
|
126375
|
+
attributes[`${import_ai_semantic_conventions.SpanAttributes.LLM_PROMPTS}.${currentIndex}.content`] = message.content || "";
|
|
126368
126376
|
} else {
|
|
126369
|
-
attributes[`${import_ai_semantic_conventions.SpanAttributes.LLM_PROMPTS}.${
|
|
126377
|
+
attributes[`${import_ai_semantic_conventions.SpanAttributes.LLM_PROMPTS}.${currentIndex}.content`] = JSON.stringify(message.content);
|
|
126370
126378
|
}
|
|
126371
126379
|
});
|
|
126372
126380
|
} else {
|
|
@@ -138786,7 +138794,7 @@ var TogetherInstrumentation = class extends InstrumentationBase13 {
|
|
|
138786
138794
|
// ../../node_modules/@traceloop/node-server-sdk/dist/index.mjs
|
|
138787
138795
|
var import_sdk_trace_node = __toESM(require_src(), 1);
|
|
138788
138796
|
var import_nunjucks = __toESM(require_nunjucks(), 1);
|
|
138789
|
-
var version14 = "0.14.
|
|
138797
|
+
var version14 = "0.14.3";
|
|
138790
138798
|
var Telemetry = class _Telemetry {
|
|
138791
138799
|
static getInstance() {
|
|
138792
138800
|
if (!_Telemetry.instance) {
|
|
@@ -138879,7 +138887,7 @@ var validateConfiguration = (options) => {
|
|
|
138879
138887
|
}
|
|
138880
138888
|
}
|
|
138881
138889
|
};
|
|
138882
|
-
var fetchRetry =
|
|
138890
|
+
var fetchRetry = (0, import_fetch_retry.default)(import_cross_fetch.default);
|
|
138883
138891
|
var fetchPrompts = async (options) => {
|
|
138884
138892
|
const { apiKey, baseUrl, traceloopSyncMaxRetries } = options;
|
|
138885
138893
|
const response = await fetchRetry(`${baseUrl}/v1/traceloop/prompts`, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "raindrop-ai",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.52",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.mjs",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"zod": "^3.23.8"
|
|
41
41
|
},
|
|
42
42
|
"optionalDependencies": {
|
|
43
|
-
"@traceloop/node-server-sdk": "^0.14.
|
|
43
|
+
"@traceloop/node-server-sdk": "^0.14.3"
|
|
44
44
|
},
|
|
45
45
|
"publishConfig": {
|
|
46
46
|
"access": "public"
|