@jeffusion/bungee-llms 6.4.1 → 6.5.1
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 +15 -1
- package/dist/plugin-api.js +15 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -5271,7 +5271,21 @@ function validateUsage(raw, protocol) {
|
|
|
5271
5271
|
if (raw === undefined || raw === null)
|
|
5272
5272
|
return;
|
|
5273
5273
|
const u = record(raw, "usage");
|
|
5274
|
-
|
|
5274
|
+
if (protocol === "chat_completions") {
|
|
5275
|
+
for (const key of ["prompt_tokens", "completion_tokens", "total_tokens"])
|
|
5276
|
+
if (u[key] !== undefined && u[key] !== null)
|
|
5277
|
+
integer(u[key], `usage.${key}`);
|
|
5278
|
+
for (const [container, counter] of [["prompt_tokens_details", "cached_tokens"], ["completion_tokens_details", "reasoning_tokens"]]) {
|
|
5279
|
+
const value = u[container];
|
|
5280
|
+
if (value === undefined || value === null)
|
|
5281
|
+
continue;
|
|
5282
|
+
const details = record(value, `usage.${container}`);
|
|
5283
|
+
if (details[counter] !== undefined && details[counter] !== null)
|
|
5284
|
+
integer(details[counter], `usage.${container}.${counter}`);
|
|
5285
|
+
}
|
|
5286
|
+
return;
|
|
5287
|
+
}
|
|
5288
|
+
const keys = protocol === "anthropic_messages" ? ["input_tokens", "output_tokens", "cache_read_input_tokens", "cache_creation_input_tokens"] : ["input_tokens", "output_tokens", "total_tokens", "input_tokens_details", "output_tokens_details"];
|
|
5275
5289
|
fields2(u, keys, "usage", "unsupported_response");
|
|
5276
5290
|
for (const [key, value] of Object.entries(u)) {
|
|
5277
5291
|
if (key.endsWith("_details")) {
|
package/dist/plugin-api.js
CHANGED
|
@@ -4311,7 +4311,21 @@ function validateUsage(raw, protocol) {
|
|
|
4311
4311
|
if (raw === undefined || raw === null)
|
|
4312
4312
|
return;
|
|
4313
4313
|
const u = record(raw, "usage");
|
|
4314
|
-
|
|
4314
|
+
if (protocol === "chat_completions") {
|
|
4315
|
+
for (const key of ["prompt_tokens", "completion_tokens", "total_tokens"])
|
|
4316
|
+
if (u[key] !== undefined && u[key] !== null)
|
|
4317
|
+
integer(u[key], `usage.${key}`);
|
|
4318
|
+
for (const [container, counter] of [["prompt_tokens_details", "cached_tokens"], ["completion_tokens_details", "reasoning_tokens"]]) {
|
|
4319
|
+
const value = u[container];
|
|
4320
|
+
if (value === undefined || value === null)
|
|
4321
|
+
continue;
|
|
4322
|
+
const details = record(value, `usage.${container}`);
|
|
4323
|
+
if (details[counter] !== undefined && details[counter] !== null)
|
|
4324
|
+
integer(details[counter], `usage.${container}.${counter}`);
|
|
4325
|
+
}
|
|
4326
|
+
return;
|
|
4327
|
+
}
|
|
4328
|
+
const keys = protocol === "anthropic_messages" ? ["input_tokens", "output_tokens", "cache_read_input_tokens", "cache_creation_input_tokens"] : ["input_tokens", "output_tokens", "total_tokens", "input_tokens_details", "output_tokens_details"];
|
|
4315
4329
|
fields2(u, keys, "usage", "unsupported_response");
|
|
4316
4330
|
for (const [key, value] of Object.entries(u)) {
|
|
4317
4331
|
if (key.endsWith("_details")) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jeffusion/bungee-llms",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.5.1",
|
|
4
4
|
"description": "Extensible LLM adapters and protocol conversion package for Bungee",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"prepublishOnly": "bun run build"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@jeffusion/bungee-types": "^6.
|
|
14
|
+
"@jeffusion/bungee-types": "^6.5.1"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
17
|
"bun-types": "^1.3.2",
|