@kenkaiiii/gg-ai 4.3.164 → 4.3.165
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.cjs +10 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +10 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -428,8 +428,8 @@ function supportsAdaptiveThinking(model) {
|
|
|
428
428
|
}
|
|
429
429
|
function toAnthropicThinking(level, maxTokens, model) {
|
|
430
430
|
if (supportsAdaptiveThinking(model)) {
|
|
431
|
-
let effort = level;
|
|
432
|
-
if (
|
|
431
|
+
let effort = level === "xhigh" ? "max" : level;
|
|
432
|
+
if (effort === "max" && !model.includes("opus")) {
|
|
433
433
|
effort = "high";
|
|
434
434
|
}
|
|
435
435
|
return {
|
|
@@ -438,7 +438,7 @@ function toAnthropicThinking(level, maxTokens, model) {
|
|
|
438
438
|
outputConfig: { effort }
|
|
439
439
|
};
|
|
440
440
|
}
|
|
441
|
-
const effectiveLevel = level === "
|
|
441
|
+
const effectiveLevel = level === "xhigh" ? "high" : level;
|
|
442
442
|
const budgetMap = {
|
|
443
443
|
low: Math.max(1024, Math.floor(maxTokens * 0.25)),
|
|
444
444
|
medium: Math.max(2048, Math.floor(maxTokens * 0.5)),
|
|
@@ -571,8 +571,12 @@ function toOpenAIToolChoice(choice) {
|
|
|
571
571
|
if (choice === "required") return "required";
|
|
572
572
|
return { type: "function", function: { name: choice.name } };
|
|
573
573
|
}
|
|
574
|
-
function
|
|
575
|
-
return
|
|
574
|
+
function isOpenAIProVariant(model) {
|
|
575
|
+
return /^gpt-5\.\d+-pro$/i.test(model);
|
|
576
|
+
}
|
|
577
|
+
function toOpenAIReasoningEffort(level, model) {
|
|
578
|
+
if (isOpenAIProVariant(model) && level === "low") return "medium";
|
|
579
|
+
return level;
|
|
576
580
|
}
|
|
577
581
|
function normalizeAnthropicStopReason(reason) {
|
|
578
582
|
switch (reason) {
|
|
@@ -1039,7 +1043,7 @@ async function* runStream2(options) {
|
|
|
1039
1043
|
...effectiveTemp != null && !options.thinking ? { temperature: effectiveTemp } : {},
|
|
1040
1044
|
...options.topP != null ? { top_p: options.topP } : {},
|
|
1041
1045
|
...options.stop ? { stop: options.stop } : {},
|
|
1042
|
-
...options.thinking && !usesThinkingParam ? { reasoning_effort: toOpenAIReasoningEffort(options.thinking) } : {},
|
|
1046
|
+
...options.thinking && !usesThinkingParam ? { reasoning_effort: toOpenAIReasoningEffort(options.thinking, options.model) } : {},
|
|
1043
1047
|
...options.tools?.length ? { tools: toOpenAITools(options.tools) } : {},
|
|
1044
1048
|
...options.toolChoice && options.tools?.length ? { tool_choice: toOpenAIToolChoice(options.toolChoice) } : {},
|
|
1045
1049
|
...useStreaming ? { stream_options: { include_usage: true } } : {}
|