@code-yeongyu/senpi 2026.7.25-2 → 2026.7.25
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/CHANGELOG.md +0 -29
- package/dist/core/agent-session.d.ts +0 -13
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +1 -23
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/extensions/builtin/config-reload/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/config-reload/index.js +17 -20
- package/dist/core/extensions/builtin/config-reload/index.js.map +1 -1
- package/dist/core/extensions/builtin/config-reload/log.d.ts +1 -4
- package/dist/core/extensions/builtin/config-reload/log.d.ts.map +1 -1
- package/dist/core/extensions/builtin/config-reload/log.js +0 -3
- package/dist/core/extensions/builtin/config-reload/log.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.6.d.ts +0 -48
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.6.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.6.js +64 -88
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.6.js.map +1 -1
- package/dist/core/extensions/builtin/websearch/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/websearch/index.js +4 -2
- package/dist/core/extensions/builtin/websearch/index.js.map +1 -1
- package/dist/core/extensions/builtin/websearch/websearch/config.d.ts.map +1 -1
- package/dist/core/extensions/builtin/websearch/websearch/config.js +1 -4
- package/dist/core/extensions/builtin/websearch/websearch/config.js.map +1 -1
- package/dist/core/extensions/builtin/websearch/websearch/native.d.ts.map +1 -1
- package/dist/core/extensions/builtin/websearch/websearch/native.js +4 -2
- package/dist/core/extensions/builtin/websearch/websearch/native.js.map +1 -1
- package/dist/core/extensions/builtin/websearch/websearch/renderers.d.ts.map +1 -1
- package/dist/core/extensions/builtin/websearch/websearch/renderers.js +8 -20
- package/dist/core/extensions/builtin/websearch/websearch/renderers.js.map +1 -1
- package/dist/core/extensions/builtin/websearch/websearch/search.d.ts +1 -6
- package/dist/core/extensions/builtin/websearch/websearch/search.d.ts.map +1 -1
- package/dist/core/extensions/builtin/websearch/websearch/search.js +11 -15
- package/dist/core/extensions/builtin/websearch/websearch/search.js.map +1 -1
- package/dist/core/extensions/builtin/websearch/websearch/tool.d.ts.map +1 -1
- package/dist/core/extensions/builtin/websearch/websearch/tool.js +10 -5
- package/dist/core/extensions/builtin/websearch/websearch/tool.js.map +1 -1
- package/dist/core/extensions/builtin/websearch/websearch/types.d.ts +0 -1
- package/dist/core/extensions/builtin/websearch/websearch/types.d.ts.map +1 -1
- package/dist/core/extensions/builtin/websearch/websearch/types.js.map +1 -1
- package/dist/core/extensions/types.d.ts +0 -2
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/model-resolver.d.ts +0 -1
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +3 -13
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/remote-catalog-provider.d.ts.map +1 -1
- package/dist/core/remote-catalog-provider.js +1 -19
- package/dist/core/remote-catalog-provider.js.map +1 -1
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +0 -3
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/retry-fallback/controller.d.ts +0 -7
- package/dist/core/retry-fallback/controller.d.ts.map +1 -1
- package/dist/core/retry-fallback/controller.js +0 -13
- package/dist/core/retry-fallback/controller.js.map +1 -1
- package/dist/core/settings-manager.d.ts +0 -7
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +0 -10
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/thinking-levels.d.ts.map +1 -1
- package/dist/core/thinking-levels.js +2 -9
- package/dist/core/thinking-levels.js.map +1 -1
- package/dist/extensions/llama/provider.d.ts.map +1 -1
- package/dist/extensions/llama/provider.js +0 -6
- package/dist/extensions/llama/provider.js.map +1 -1
- package/dist/modes/interactive/components/custom-message.d.ts +1 -3
- package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-message.js +2 -9
- package/dist/modes/interactive/components/custom-message.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +2 -9
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/package-manager-cli.d.ts.map +1 -1
- package/dist/package-manager-cli.js +0 -11
- package/dist/package-manager-cli.js.map +1 -1
- package/docs/extensions.md +2 -2
- package/docs/settings.md +0 -11
- package/examples/extensions/message-renderer.ts +2 -2
- package/node_modules/@code-yeongyu/senpi-codemode/CHANGELOG.md +0 -12
- package/node_modules/@code-yeongyu/senpi-codemode/package.json +3 -3
- package/node_modules/@earendil-works/pi-agent-core/dist/agent.d.ts +0 -3
- package/node_modules/@earendil-works/pi-agent-core/dist/agent.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/agent.js +0 -2
- package/node_modules/@earendil-works/pi-agent-core/dist/agent.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/package.json +2 -2
- package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js +22 -87
- package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.js +7 -15
- package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.js +16 -38
- package/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.js +2 -9
- package/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.js +2 -12
- package/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.js +11 -19
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js +23 -121
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js +7 -12
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/simple-options.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/simple-options.js +0 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/simple-options.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/radius.d.ts +2 -3
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/radius.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/radius.js +35 -37
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/radius.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/resolve.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/resolve.js +1 -11
- package/node_modules/@earendil-works/pi-ai/dist/auth/resolve.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/index.d.ts +0 -1
- package/node_modules/@earendil-works/pi-ai/dist/index.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/index.js +0 -1
- package/node_modules/@earendil-works/pi-ai/dist/index.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/models-store.d.ts +0 -5
- package/node_modules/@earendil-works/pi-ai/dist/models-store.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/models-store.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/models.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/models.js +1 -5
- package/node_modules/@earendil-works/pi-ai/dist/models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/amazon-bedrock.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/anthropic.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/cloudflare-ai-gateway.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/github-copilot.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/vercel-ai-gateway.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/types.d.ts +0 -9
- package/node_modules/@earendil-works/pi-ai/dist/types.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/types.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/error-body.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/error-body.js +3 -8
- package/node_modules/@earendil-works/pi-ai/dist/utils/error-body.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/package.json +1 -1
- package/node_modules/@earendil-works/pi-pty/package.json +1 -1
- package/node_modules/@earendil-works/pi-tui/package.json +1 -1
- package/package.json +6 -6
- package/dist/beta/omo-local-update.d.ts +0 -207
- package/dist/beta/omo-local-update.d.ts.map +0 -1
- package/dist/beta/omo-local-update.js +0 -708
- package/dist/beta/omo-local-update.js.map +0 -1
- package/dist/core/extensions/builtin/config-reload/routine-settings.d.ts +0 -15
- package/dist/core/extensions/builtin/config-reload/routine-settings.d.ts.map +0 -1
- package/dist/core/extensions/builtin/config-reload/routine-settings.js +0 -102
- package/dist/core/extensions/builtin/config-reload/routine-settings.js.map +0 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/server-fallback-receipt.d.ts +0 -30
- package/node_modules/@earendil-works/pi-ai/dist/utils/server-fallback-receipt.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/server-fallback-receipt.js +0 -70
- package/node_modules/@earendil-works/pi-ai/dist/utils/server-fallback-receipt.js.map +0 -1
|
@@ -15,87 +15,6 @@ import { buildCopilotDynamicHeaders, hasCopilotVisionInput } from "./github-copi
|
|
|
15
15
|
import { clampOpenAIPromptCacheKey } from "./openai-prompt-cache.js";
|
|
16
16
|
import { applyExtraBody, buildBaseOptions, clampMaxForOpenAI, OPENAI_COMPLETIONS_RESERVED_BODY_KEYS, } from "./simple-options.js";
|
|
17
17
|
import { transformMessages } from "./transform-messages.js";
|
|
18
|
-
const KIMI_K3_THINKING_LEVEL_MAP = {
|
|
19
|
-
off: null,
|
|
20
|
-
minimal: null,
|
|
21
|
-
low: "low",
|
|
22
|
-
medium: null,
|
|
23
|
-
high: "high",
|
|
24
|
-
xhigh: null,
|
|
25
|
-
max: "max",
|
|
26
|
-
};
|
|
27
|
-
const DEEPSEEK_THINKING_LEVEL_MAP = {
|
|
28
|
-
minimal: "high",
|
|
29
|
-
low: "high",
|
|
30
|
-
medium: "high",
|
|
31
|
-
high: "high",
|
|
32
|
-
xhigh: "max",
|
|
33
|
-
max: "max",
|
|
34
|
-
};
|
|
35
|
-
const OPENROUTER_DEEPSEEK_THINKING_LEVEL_MAP = {
|
|
36
|
-
minimal: "high",
|
|
37
|
-
low: "high",
|
|
38
|
-
medium: "high",
|
|
39
|
-
high: "high",
|
|
40
|
-
xhigh: "high",
|
|
41
|
-
max: "high",
|
|
42
|
-
};
|
|
43
|
-
const MIMO_THINKING_LEVEL_MAP = {
|
|
44
|
-
minimal: "low",
|
|
45
|
-
low: "low",
|
|
46
|
-
medium: "medium",
|
|
47
|
-
high: "high",
|
|
48
|
-
xhigh: "high",
|
|
49
|
-
max: null,
|
|
50
|
-
};
|
|
51
|
-
const OLLAMA_THINKING_LEVEL_MAP = {
|
|
52
|
-
off: "none",
|
|
53
|
-
minimal: null,
|
|
54
|
-
low: "low",
|
|
55
|
-
medium: "medium",
|
|
56
|
-
high: "high",
|
|
57
|
-
xhigh: null,
|
|
58
|
-
max: "max",
|
|
59
|
-
};
|
|
60
|
-
function getThinkingLevelMap(model, compat) {
|
|
61
|
-
if (model.thinkingLevelMap !== undefined) {
|
|
62
|
-
return model.thinkingLevelMap;
|
|
63
|
-
}
|
|
64
|
-
const id = model.id.toLowerCase();
|
|
65
|
-
const isKimiK3 = id === "k3" || id.startsWith("k3-") || /(?:^|[/:-])kimi-k3(?:$|[/.:_-])/.test(id);
|
|
66
|
-
const isDeepSeek = id.includes("deepseek");
|
|
67
|
-
const isMiMo = /\bmimo\b/.test(id);
|
|
68
|
-
const isGlm52 = /(?:^|[/:-])glm-5\.2(?:$|[/.:_-])/.test(id);
|
|
69
|
-
if (model.provider === "ollama") {
|
|
70
|
-
return OLLAMA_THINKING_LEVEL_MAP;
|
|
71
|
-
}
|
|
72
|
-
if (isKimiK3) {
|
|
73
|
-
return KIMI_K3_THINKING_LEVEL_MAP;
|
|
74
|
-
}
|
|
75
|
-
if (compat.thinkingFormat === "openrouter" && isDeepSeek) {
|
|
76
|
-
return OPENROUTER_DEEPSEEK_THINKING_LEVEL_MAP;
|
|
77
|
-
}
|
|
78
|
-
if ((compat.thinkingFormat === "openai" || compat.thinkingFormat === "openrouter") && isMiMo) {
|
|
79
|
-
return MIMO_THINKING_LEVEL_MAP;
|
|
80
|
-
}
|
|
81
|
-
if (isDeepSeek) {
|
|
82
|
-
return DEEPSEEK_THINKING_LEVEL_MAP;
|
|
83
|
-
}
|
|
84
|
-
if (isGlm52) {
|
|
85
|
-
if (compat.thinkingFormat === "zai") {
|
|
86
|
-
return DEEPSEEK_THINKING_LEVEL_MAP;
|
|
87
|
-
}
|
|
88
|
-
if (compat.thinkingFormat === "openrouter") {
|
|
89
|
-
return { xhigh: "xhigh" };
|
|
90
|
-
}
|
|
91
|
-
return { max: "max" };
|
|
92
|
-
}
|
|
93
|
-
return undefined;
|
|
94
|
-
}
|
|
95
|
-
function resolveReasoningEffort(thinkingLevelMap, effort) {
|
|
96
|
-
const mapped = thinkingLevelMap?.[effort];
|
|
97
|
-
return mapped === undefined ? effort : typeof mapped === "string" ? mapped : undefined;
|
|
98
|
-
}
|
|
99
18
|
/**
|
|
100
19
|
* Check if conversation messages contain tool calls or tool results.
|
|
101
20
|
* This is needed because Anthropic (via proxy) requires the tools param
|
|
@@ -578,15 +497,12 @@ export const stream = (model, context, options) => {
|
|
|
578
497
|
export const streamSimple = (model, context, options) => {
|
|
579
498
|
getClientApiKey(model.provider, options?.apiKey, options?.headers);
|
|
580
499
|
const base = buildBaseOptions(model, context, options, options?.apiKey);
|
|
581
|
-
const
|
|
582
|
-
const thinkingLevelMap = getThinkingLevelMap(model, compat);
|
|
583
|
-
const thinkingModel = thinkingLevelMap === model.thinkingLevelMap ? model : { ...model, thinkingLevelMap };
|
|
584
|
-
const clampedReasoning = options?.reasoning ? clampThinkingLevel(thinkingModel, options.reasoning) : undefined;
|
|
500
|
+
const clampedReasoning = options?.reasoning ? clampThinkingLevel(model, options.reasoning) : undefined;
|
|
585
501
|
const reasoningEffort = clampedReasoning === "off"
|
|
586
502
|
? undefined
|
|
587
|
-
: clampedReasoning === "max" && thinkingLevelMap?.max !== undefined
|
|
503
|
+
: clampedReasoning === "max" && model.thinkingLevelMap?.max !== undefined
|
|
588
504
|
? "max"
|
|
589
|
-
: clampMaxForOpenAI(clampedReasoning, supportsXhigh(
|
|
505
|
+
: clampMaxForOpenAI(clampedReasoning, supportsXhigh(model));
|
|
590
506
|
const toolChoice = options?.toolChoice;
|
|
591
507
|
return stream(model, context, {
|
|
592
508
|
...base,
|
|
@@ -633,7 +549,6 @@ function buildParams(model, context, options, compat = getCompat(model), cacheRe
|
|
|
633
549
|
grammarToolInputProperties,
|
|
634
550
|
});
|
|
635
551
|
const cacheControl = getCompatCacheControl(compat, cacheRetention);
|
|
636
|
-
const thinkingLevelMap = getThinkingLevelMap(model, compat);
|
|
637
552
|
const params = {
|
|
638
553
|
model: model.id,
|
|
639
554
|
messages,
|
|
@@ -683,8 +598,9 @@ function buildParams(model, context, options, compat = getCompat(model), cacheRe
|
|
|
683
598
|
const zaiParams = params;
|
|
684
599
|
zaiParams.thinking = options?.reasoningEffort ? { type: "enabled", clear_thinking: false } : { type: "disabled" };
|
|
685
600
|
if (options?.reasoningEffort && compat.supportsReasoningEffort) {
|
|
686
|
-
const
|
|
687
|
-
|
|
601
|
+
const mappedEffort = model.thinkingLevelMap?.[options.reasoningEffort];
|
|
602
|
+
const effort = mappedEffort === undefined ? options.reasoningEffort : mappedEffort;
|
|
603
|
+
if (typeof effort === "string") {
|
|
688
604
|
zaiParams.reasoning_effort = effort;
|
|
689
605
|
}
|
|
690
606
|
}
|
|
@@ -708,13 +624,10 @@ function buildParams(model, context, options, compat = getCompat(model), cacheRe
|
|
|
708
624
|
if (options?.reasoningEffort) {
|
|
709
625
|
params.thinking = { type: "enabled" };
|
|
710
626
|
if (compat.supportsReasoningEffort) {
|
|
711
|
-
|
|
712
|
-
if (effort !== undefined) {
|
|
713
|
-
params.reasoning_effort = effort;
|
|
714
|
-
}
|
|
627
|
+
params.reasoning_effort = model.thinkingLevelMap?.[options.reasoningEffort] ?? options.reasoningEffort;
|
|
715
628
|
}
|
|
716
629
|
}
|
|
717
|
-
else if (compat.supportsDisabledThinking !== false && thinkingLevelMap?.off !== null) {
|
|
630
|
+
else if (compat.supportsDisabledThinking !== false && model.thinkingLevelMap?.off !== null) {
|
|
718
631
|
params.thinking = { type: "disabled" };
|
|
719
632
|
}
|
|
720
633
|
}
|
|
@@ -722,17 +635,16 @@ function buildParams(model, context, options, compat = getCompat(model), cacheRe
|
|
|
722
635
|
// OpenRouter normalizes reasoning across providers via a nested reasoning object.
|
|
723
636
|
const openRouterParams = params;
|
|
724
637
|
if (options?.reasoningEffort) {
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
}
|
|
638
|
+
openRouterParams.reasoning = {
|
|
639
|
+
effort: model.thinkingLevelMap?.[options.reasoningEffort] ?? options.reasoningEffort,
|
|
640
|
+
};
|
|
729
641
|
}
|
|
730
|
-
else if (thinkingLevelMap?.off !== null) {
|
|
731
|
-
openRouterParams.reasoning = { effort: thinkingLevelMap?.off ?? "none" };
|
|
642
|
+
else if (model.thinkingLevelMap?.off !== null) {
|
|
643
|
+
openRouterParams.reasoning = { effort: model.thinkingLevelMap?.off ?? "none" };
|
|
732
644
|
}
|
|
733
645
|
}
|
|
734
646
|
else if (compat.thinkingFormat === "ant-ling" && model.reasoning && options?.reasoningEffort) {
|
|
735
|
-
const effort = thinkingLevelMap?.[options.reasoningEffort];
|
|
647
|
+
const effort = model.thinkingLevelMap?.[options.reasoningEffort];
|
|
736
648
|
if (typeof effort === "string") {
|
|
737
649
|
params.reasoning = { effort };
|
|
738
650
|
}
|
|
@@ -741,32 +653,23 @@ function buildParams(model, context, options, compat = getCompat(model), cacheRe
|
|
|
741
653
|
const togetherParams = params;
|
|
742
654
|
togetherParams.reasoning = { enabled: !!options?.reasoningEffort };
|
|
743
655
|
if (options?.reasoningEffort && compat.supportsReasoningEffort) {
|
|
744
|
-
|
|
745
|
-
if (effort !== undefined) {
|
|
746
|
-
togetherParams.reasoning_effort = effort;
|
|
747
|
-
}
|
|
656
|
+
togetherParams.reasoning_effort = model.thinkingLevelMap?.[options.reasoningEffort] ?? options.reasoningEffort;
|
|
748
657
|
}
|
|
749
658
|
}
|
|
750
659
|
else if (compat.thinkingFormat === "string-thinking" && model.reasoning) {
|
|
751
660
|
if (options?.reasoningEffort) {
|
|
752
|
-
|
|
753
|
-
if (effort !== undefined) {
|
|
754
|
-
params.thinking = effort;
|
|
755
|
-
}
|
|
661
|
+
params.thinking = model.thinkingLevelMap?.[options.reasoningEffort] ?? options.reasoningEffort;
|
|
756
662
|
}
|
|
757
|
-
else if (thinkingLevelMap?.off !== null) {
|
|
758
|
-
params.thinking = thinkingLevelMap?.off ?? "none";
|
|
663
|
+
else if (model.thinkingLevelMap?.off !== null) {
|
|
664
|
+
params.thinking = model.thinkingLevelMap?.off ?? "none";
|
|
759
665
|
}
|
|
760
666
|
}
|
|
761
667
|
else if (options?.reasoningEffort && model.reasoning && compat.supportsReasoningEffort) {
|
|
762
668
|
// OpenAI-style reasoning_effort
|
|
763
|
-
|
|
764
|
-
if (effort !== undefined) {
|
|
765
|
-
params.reasoning_effort = effort;
|
|
766
|
-
}
|
|
669
|
+
params.reasoning_effort = model.thinkingLevelMap?.[options.reasoningEffort] ?? options.reasoningEffort;
|
|
767
670
|
}
|
|
768
671
|
else if (!options?.reasoningEffort && model.reasoning && compat.supportsReasoningEffort) {
|
|
769
|
-
const offValue = thinkingLevelMap?.off;
|
|
672
|
+
const offValue = model.thinkingLevelMap?.off;
|
|
770
673
|
if (typeof offValue === "string") {
|
|
771
674
|
params.reasoning_effort = offValue;
|
|
772
675
|
}
|
|
@@ -793,14 +696,14 @@ function buildParams(model, context, options, compat = getCompat(model), cacheRe
|
|
|
793
696
|
function buildChatTemplateKwargs(model, options, compat) {
|
|
794
697
|
const kwargs = {};
|
|
795
698
|
for (const [key, value] of Object.entries(compat.chatTemplateKwargs)) {
|
|
796
|
-
const resolved = resolveChatTemplateKwargValue(model, options,
|
|
699
|
+
const resolved = resolveChatTemplateKwargValue(model, options, value);
|
|
797
700
|
if (resolved !== undefined) {
|
|
798
701
|
kwargs[key] = resolved;
|
|
799
702
|
}
|
|
800
703
|
}
|
|
801
704
|
return Object.keys(kwargs).length > 0 ? kwargs : undefined;
|
|
802
705
|
}
|
|
803
|
-
function resolveChatTemplateKwargValue(model, options,
|
|
706
|
+
function resolveChatTemplateKwargValue(model, options, value) {
|
|
804
707
|
if (typeof value !== "object" || value === null) {
|
|
805
708
|
return value;
|
|
806
709
|
}
|
|
@@ -811,8 +714,7 @@ function resolveChatTemplateKwargValue(model, options, compat, value) {
|
|
|
811
714
|
if (value.$var === "thinking.enabled") {
|
|
812
715
|
return !!reasoningEffort;
|
|
813
716
|
}
|
|
814
|
-
const
|
|
815
|
-
const mappedValue = reasoningEffort ? thinkingLevelMap?.[reasoningEffort] : thinkingLevelMap?.off;
|
|
717
|
+
const mappedValue = reasoningEffort ? model.thinkingLevelMap?.[reasoningEffort] : model.thinkingLevelMap?.off;
|
|
816
718
|
return mappedValue === undefined ? reasoningEffort : typeof mappedValue === "string" ? mappedValue : undefined;
|
|
817
719
|
}
|
|
818
720
|
function getCompatCacheControl(compat, cacheRetention) {
|