@kenkaiiii/gg-ai 5.91.0 → 5.91.2
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/LICENSE +661 -21
- package/NOTICE +52 -0
- package/README.md +72 -68
- package/dist/index.cjs +15 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +15 -1
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
package/dist/index.d.cts
CHANGED
|
@@ -241,6 +241,8 @@ interface StreamOptions {
|
|
|
241
241
|
topP?: number;
|
|
242
242
|
stop?: string[];
|
|
243
243
|
thinking?: ThinkingLevel;
|
|
244
|
+
/** Effort rungs the endpoint itself declared for this model (synced gateway catalogs). */
|
|
245
|
+
thinkingLevels?: readonly ThinkingLevel[];
|
|
244
246
|
apiKey?: string;
|
|
245
247
|
baseUrl?: string;
|
|
246
248
|
signal?: AbortSignal;
|
package/dist/index.d.ts
CHANGED
|
@@ -241,6 +241,8 @@ interface StreamOptions {
|
|
|
241
241
|
topP?: number;
|
|
242
242
|
stop?: string[];
|
|
243
243
|
thinking?: ThinkingLevel;
|
|
244
|
+
/** Effort rungs the endpoint itself declared for this model (synced gateway catalogs). */
|
|
245
|
+
thinkingLevels?: readonly ThinkingLevel[];
|
|
244
246
|
apiKey?: string;
|
|
245
247
|
baseUrl?: string;
|
|
246
248
|
signal?: AbortSignal;
|
package/dist/index.js
CHANGED
|
@@ -1974,6 +1974,14 @@ function toCodexReasoningEffort(level, model) {
|
|
|
1974
1974
|
if (level !== "ultra") return level;
|
|
1975
1975
|
return model === "gpt-6-astra" || model === "gpt-6.1-sol" ? "xhigh" : "max";
|
|
1976
1976
|
}
|
|
1977
|
+
var DECLARED_EFFORT_ORDER = ["low", "medium", "high", "xhigh", "max"];
|
|
1978
|
+
function effortForRequest(level, model, declared) {
|
|
1979
|
+
const rungs = DECLARED_EFFORT_ORDER.filter((rung) => declared?.includes(rung));
|
|
1980
|
+
if (rungs.length === 0) return toOpenAIReasoningEffort(level, model);
|
|
1981
|
+
const wanted = level === "ultra" ? DECLARED_EFFORT_ORDER.length - 1 : DECLARED_EFFORT_ORDER.indexOf(level);
|
|
1982
|
+
const atOrBelow = rungs.filter((rung) => DECLARED_EFFORT_ORDER.indexOf(rung) <= wanted);
|
|
1983
|
+
return atOrBelow[atOrBelow.length - 1] ?? rungs[0];
|
|
1984
|
+
}
|
|
1977
1985
|
function toOpenAIReasoningEffort(level, model) {
|
|
1978
1986
|
const effort = level === "max" || level === "ultra" ? "xhigh" : level;
|
|
1979
1987
|
if (model.startsWith("fugu") && (effort === "low" || effort === "medium")) {
|
|
@@ -3009,7 +3017,13 @@ async function* runStream2(options) {
|
|
|
3009
3017
|
...effectiveTemp != null && !options.thinking && !hasFixedKimiSampling ? { temperature: effectiveTemp } : {},
|
|
3010
3018
|
...options.topP != null && !hasFixedKimiSampling ? { top_p: options.topP } : {},
|
|
3011
3019
|
...options.stop ? { stop: options.stop } : {},
|
|
3012
|
-
...options.thinking && !usesThinkingParam && !isKimiK3 && !isKimiK27 && !isLocal ? {
|
|
3020
|
+
...options.thinking && !usesThinkingParam && !isKimiK3 && !isKimiK27 && !isLocal ? {
|
|
3021
|
+
reasoning_effort: effortForRequest(
|
|
3022
|
+
options.thinking,
|
|
3023
|
+
options.model,
|
|
3024
|
+
options.thinkingLevels
|
|
3025
|
+
)
|
|
3026
|
+
} : {},
|
|
3013
3027
|
...options.tools?.length ? {
|
|
3014
3028
|
tools: toOpenAITools(options.tools, {
|
|
3015
3029
|
strict: supportsStrictToolSampling(options.provider) && (options.strictTools ?? true)
|