@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.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
|
|
3
3
|
type Provider = "anthropic" | "xiaomi" | "openai" | "glm" | "moonshot" | "minimax" | "deepseek" | "openrouter" | "palsu";
|
|
4
|
-
type ThinkingLevel = "low" | "medium" | "high" | "
|
|
4
|
+
type ThinkingLevel = "low" | "medium" | "high" | "xhigh";
|
|
5
5
|
type CacheRetention = "none" | "short" | "long";
|
|
6
6
|
interface TextContent {
|
|
7
7
|
type: "text";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
|
|
3
3
|
type Provider = "anthropic" | "xiaomi" | "openai" | "glm" | "moonshot" | "minimax" | "deepseek" | "openrouter" | "palsu";
|
|
4
|
-
type ThinkingLevel = "low" | "medium" | "high" | "
|
|
4
|
+
type ThinkingLevel = "low" | "medium" | "high" | "xhigh";
|
|
5
5
|
type CacheRetention = "none" | "short" | "long";
|
|
6
6
|
interface TextContent {
|
|
7
7
|
type: "text";
|
package/dist/index.js
CHANGED
|
@@ -382,8 +382,8 @@ function supportsAdaptiveThinking(model) {
|
|
|
382
382
|
}
|
|
383
383
|
function toAnthropicThinking(level, maxTokens, model) {
|
|
384
384
|
if (supportsAdaptiveThinking(model)) {
|
|
385
|
-
let effort = level;
|
|
386
|
-
if (
|
|
385
|
+
let effort = level === "xhigh" ? "max" : level;
|
|
386
|
+
if (effort === "max" && !model.includes("opus")) {
|
|
387
387
|
effort = "high";
|
|
388
388
|
}
|
|
389
389
|
return {
|
|
@@ -392,7 +392,7 @@ function toAnthropicThinking(level, maxTokens, model) {
|
|
|
392
392
|
outputConfig: { effort }
|
|
393
393
|
};
|
|
394
394
|
}
|
|
395
|
-
const effectiveLevel = level === "
|
|
395
|
+
const effectiveLevel = level === "xhigh" ? "high" : level;
|
|
396
396
|
const budgetMap = {
|
|
397
397
|
low: Math.max(1024, Math.floor(maxTokens * 0.25)),
|
|
398
398
|
medium: Math.max(2048, Math.floor(maxTokens * 0.5)),
|
|
@@ -525,8 +525,12 @@ function toOpenAIToolChoice(choice) {
|
|
|
525
525
|
if (choice === "required") return "required";
|
|
526
526
|
return { type: "function", function: { name: choice.name } };
|
|
527
527
|
}
|
|
528
|
-
function
|
|
529
|
-
return
|
|
528
|
+
function isOpenAIProVariant(model) {
|
|
529
|
+
return /^gpt-5\.\d+-pro$/i.test(model);
|
|
530
|
+
}
|
|
531
|
+
function toOpenAIReasoningEffort(level, model) {
|
|
532
|
+
if (isOpenAIProVariant(model) && level === "low") return "medium";
|
|
533
|
+
return level;
|
|
530
534
|
}
|
|
531
535
|
function normalizeAnthropicStopReason(reason) {
|
|
532
536
|
switch (reason) {
|
|
@@ -993,7 +997,7 @@ async function* runStream2(options) {
|
|
|
993
997
|
...effectiveTemp != null && !options.thinking ? { temperature: effectiveTemp } : {},
|
|
994
998
|
...options.topP != null ? { top_p: options.topP } : {},
|
|
995
999
|
...options.stop ? { stop: options.stop } : {},
|
|
996
|
-
...options.thinking && !usesThinkingParam ? { reasoning_effort: toOpenAIReasoningEffort(options.thinking) } : {},
|
|
1000
|
+
...options.thinking && !usesThinkingParam ? { reasoning_effort: toOpenAIReasoningEffort(options.thinking, options.model) } : {},
|
|
997
1001
|
...options.tools?.length ? { tools: toOpenAITools(options.tools) } : {},
|
|
998
1002
|
...options.toolChoice && options.tools?.length ? { tool_choice: toOpenAIToolChoice(options.toolChoice) } : {},
|
|
999
1003
|
...useStreaming ? { stream_options: { include_usage: true } } : {}
|