@rulvar/openai 1.144.0 → 1.145.0
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 +16 -8
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1164,16 +1164,24 @@ function reconcileStatement(invoice, statement, options) {
|
|
|
1164
1164
|
componentsSeen += 1;
|
|
1165
1165
|
}
|
|
1166
1166
|
}
|
|
1167
|
+
if (componentsSeen === 0) throw new ConfigError(`statement reconciliation refused: ${where} declares componentsUsd with no component figures; an empty object is not evidence: drop the field or export the split`);
|
|
1167
1168
|
if (row.usd !== void 0 && componentsSeen > 0 && Math.abs(row.usd - componentsSum) > totalToleranceUsd) throw new ConfigError(`statement reconciliation refused: ${where} carries usd ${String(row.usd)} and a component split summing to ${String(componentsSum)}, claims that contradict each other beyond the ${String(totalToleranceUsd)} totals tolerance; an export whose own total disagrees with its own components is not evidence: normalize it to one dollar claim per row or fix the export`);
|
|
1168
1169
|
}
|
|
1169
|
-
if (row.usage !== void 0)
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1170
|
+
if (row.usage !== void 0) {
|
|
1171
|
+
let usageSeen = 0;
|
|
1172
|
+
for (const field of [
|
|
1173
|
+
"inputTokens",
|
|
1174
|
+
"cachedInputTokens",
|
|
1175
|
+
"cacheWriteTokens",
|
|
1176
|
+
"outputTokens"
|
|
1177
|
+
]) {
|
|
1178
|
+
const count = row.usage[field];
|
|
1179
|
+
if (count !== void 0) {
|
|
1180
|
+
assertTokenCount(where, `usage.${field}`, count);
|
|
1181
|
+
usageSeen += 1;
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
if (usageSeen === 0) throw new ConfigError(`statement reconciliation refused: ${where} declares usage with no token counts; an empty object is not evidence: drop the field or export the counts`);
|
|
1177
1185
|
}
|
|
1178
1186
|
byId.set(row.responseId, row);
|
|
1179
1187
|
if (row.usd !== void 0 || row.componentsUsd !== void 0 || row.usage !== void 0) carriesAnything = true;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rulvar/openai",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.145.0",
|
|
4
4
|
"description": "Rulvar first-class provider adapter for the OpenAI Responses API, plus the openaiCompatible factory.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -23,13 +23,13 @@
|
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"openai": "^6.49.0",
|
|
26
|
-
"@rulvar/core": "1.
|
|
26
|
+
"@rulvar/core": "1.145.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@types/node": "^22.20.1",
|
|
30
30
|
"tsdown": "^0.22.14",
|
|
31
31
|
"typescript": "~6.0.3",
|
|
32
|
-
"@rulvar/testing": "1.
|
|
32
|
+
"@rulvar/testing": "1.145.0"
|
|
33
33
|
},
|
|
34
34
|
"repository": {
|
|
35
35
|
"type": "git",
|