@rulvar/openai 1.74.0 → 1.75.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 +28 -4
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -16,6 +16,7 @@ function responses(contextWindow, maxOutputTokens, pricing, options) {
|
|
|
16
16
|
reasoningEfforts: [...REASONING_EFFORTS, "max"],
|
|
17
17
|
contextWindow,
|
|
18
18
|
maxOutputTokens,
|
|
19
|
+
minOutputTokensPerTurn: 16,
|
|
19
20
|
...pricing === void 0 ? {} : { pricing }
|
|
20
21
|
},
|
|
21
22
|
api: "responses",
|
|
@@ -236,7 +237,7 @@ function buildResponsesParams(req, ids, options) {
|
|
|
236
237
|
type: "function_call",
|
|
237
238
|
call_id: ids.wireFor(part.id),
|
|
238
239
|
name: part.name,
|
|
239
|
-
arguments:
|
|
240
|
+
arguments: argumentsTextOf(part.args)
|
|
240
241
|
});
|
|
241
242
|
break;
|
|
242
243
|
case "tool-result":
|
|
@@ -557,11 +558,34 @@ function retryAfterMsFrom(header) {
|
|
|
557
558
|
if (match === null) return;
|
|
558
559
|
return Math.min(Number(match[1]) * 1e3, MAX_RETRY_AFTER_MS);
|
|
559
560
|
}
|
|
560
|
-
/**
|
|
561
|
+
/**
|
|
562
|
+
* A plain nonnegative SAFE integer header value, or undefined. The
|
|
563
|
+
* digit-run grammar alone still admits an arbitrarily long run, and
|
|
564
|
+
* Number() turns 400 digits into Infinity (the v1.74 experiment
|
|
565
|
+
* review, P2.11): an unsafe value is dropped, never normalized.
|
|
566
|
+
*/
|
|
561
567
|
function limitHeaderValue(header) {
|
|
562
568
|
if (header === void 0) return;
|
|
563
569
|
const match = /^[\t ]*([0-9]+)[\t ]*$/.exec(header);
|
|
564
|
-
|
|
570
|
+
if (match === null) return;
|
|
571
|
+
const value = Number(match[1]);
|
|
572
|
+
return Number.isSafeInteger(value) ? value : void 0;
|
|
573
|
+
}
|
|
574
|
+
/**
|
|
575
|
+
* Serializes tool-call arguments for re-projection into the request. An
|
|
576
|
+
* adapter parse-failure wrapper ({__unparsed: raw} and nothing else)
|
|
577
|
+
* projects as the ORIGINAL raw string the model wrote (the v1.74
|
|
578
|
+
* experiment review): re-encoding the internal wrapper showed the live
|
|
579
|
+
* model {"__unparsed":"..."} as its own past call, taught it to imitate
|
|
580
|
+
* that shape, and doubled the history bytes with escaping.
|
|
581
|
+
*/
|
|
582
|
+
function argumentsTextOf(args) {
|
|
583
|
+
if (typeof args === "object" && args !== null && !Array.isArray(args)) {
|
|
584
|
+
const keys = Object.keys(args);
|
|
585
|
+
const raw = args.__unparsed;
|
|
586
|
+
if (keys.length === 1 && keys[0] === "__unparsed" && typeof raw === "string") return raw;
|
|
587
|
+
}
|
|
588
|
+
return JSON.stringify(args ?? {});
|
|
565
589
|
}
|
|
566
590
|
/** Projects SDK/API errors into the retryable WireError vocabulary. */
|
|
567
591
|
function openAiErrorToWire(error) {
|
|
@@ -643,7 +667,7 @@ function buildChatCompletionsParams(req, ids) {
|
|
|
643
667
|
type: "function",
|
|
644
668
|
function: {
|
|
645
669
|
name: call.name,
|
|
646
|
-
arguments:
|
|
670
|
+
arguments: argumentsTextOf(call.args)
|
|
647
671
|
}
|
|
648
672
|
};
|
|
649
673
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rulvar/openai",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.75.1",
|
|
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.45.0",
|
|
26
|
-
"@rulvar/core": "1.
|
|
26
|
+
"@rulvar/core": "1.75.1"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@types/node": "^22.20.0",
|
|
30
30
|
"tsdown": "^0.22.3",
|
|
31
31
|
"typescript": "~6.0.3",
|
|
32
|
-
"@rulvar/testing": "1.
|
|
32
|
+
"@rulvar/testing": "1.75.1"
|
|
33
33
|
},
|
|
34
34
|
"repository": {
|
|
35
35
|
"type": "git",
|