caplyr 0.1.7 → 0.1.8
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 +7 -10
- package/dist/index.mjs +7 -10
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -293,16 +293,13 @@ function enforcePreCall(model, config, heartbeat, shipper, provider, startTime)
|
|
|
293
293
|
dashboard_url: dashboardUrl
|
|
294
294
|
};
|
|
295
295
|
pushBlockedLog(shipper, provider, model, startTime, reason, config.endpoint_tag);
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
});
|
|
304
|
-
return { proceed: true, model, downgraded: false, enforcementReason: reason };
|
|
305
|
-
}
|
|
296
|
+
config.onEnforcement?.({
|
|
297
|
+
type: "kill_switch",
|
|
298
|
+
timestamp: Date.now(),
|
|
299
|
+
reason: blockError.message,
|
|
300
|
+
budget_used: blockError.budget_used,
|
|
301
|
+
budget_limit: blockError.budget_limit
|
|
302
|
+
});
|
|
306
303
|
throw Object.assign(new Error(blockError.message), { caplyr: blockError });
|
|
307
304
|
}
|
|
308
305
|
if (config.mode === "cost_protect") {
|
package/dist/index.mjs
CHANGED
|
@@ -260,16 +260,13 @@ function enforcePreCall(model, config, heartbeat, shipper, provider, startTime)
|
|
|
260
260
|
dashboard_url: dashboardUrl
|
|
261
261
|
};
|
|
262
262
|
pushBlockedLog(shipper, provider, model, startTime, reason, config.endpoint_tag);
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
});
|
|
271
|
-
return { proceed: true, model, downgraded: false, enforcementReason: reason };
|
|
272
|
-
}
|
|
263
|
+
config.onEnforcement?.({
|
|
264
|
+
type: "kill_switch",
|
|
265
|
+
timestamp: Date.now(),
|
|
266
|
+
reason: blockError.message,
|
|
267
|
+
budget_used: blockError.budget_used,
|
|
268
|
+
budget_limit: blockError.budget_limit
|
|
269
|
+
});
|
|
273
270
|
throw Object.assign(new Error(blockError.message), { caplyr: blockError });
|
|
274
271
|
}
|
|
275
272
|
if (config.mode === "cost_protect") {
|