@llumiverse/common 1.1.0 → 1.2.0
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/lib/cjs/index.js +1 -0
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/options/bedrock.js +32 -76
- package/lib/cjs/options/bedrock.js.map +1 -1
- package/lib/cjs/options/context-windows.js +2 -0
- package/lib/cjs/options/context-windows.js.map +1 -1
- package/lib/cjs/options/openai.js +22 -3
- package/lib/cjs/options/openai.js.map +1 -1
- package/lib/cjs/options/shared-parsing.js +144 -0
- package/lib/cjs/options/shared-parsing.js.map +1 -0
- package/lib/cjs/options/version-parsing.js +326 -0
- package/lib/cjs/options/version-parsing.js.map +1 -0
- package/lib/cjs/options/vertexai.js +35 -199
- package/lib/cjs/options/vertexai.js.map +1 -1
- package/lib/cjs/types.js +2 -1
- package/lib/cjs/types.js.map +1 -1
- package/lib/esm/index.js +1 -0
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/options/bedrock.js +32 -76
- package/lib/esm/options/bedrock.js.map +1 -1
- package/lib/esm/options/context-windows.js +2 -0
- package/lib/esm/options/context-windows.js.map +1 -1
- package/lib/esm/options/openai.js +22 -3
- package/lib/esm/options/openai.js.map +1 -1
- package/lib/esm/options/shared-parsing.js +135 -0
- package/lib/esm/options/shared-parsing.js.map +1 -0
- package/lib/esm/options/version-parsing.js +310 -0
- package/lib/esm/options/version-parsing.js.map +1 -0
- package/lib/esm/options/vertexai.js +28 -190
- package/lib/esm/options/vertexai.js.map +1 -1
- package/lib/esm/types.js +2 -1
- package/lib/esm/types.js.map +1 -1
- package/lib/types/index.d.ts +1 -0
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/options/bedrock.d.ts +2 -2
- package/lib/types/options/bedrock.d.ts.map +1 -1
- package/lib/types/options/context-windows.d.ts.map +1 -1
- package/lib/types/options/openai.d.ts +3 -2
- package/lib/types/options/openai.d.ts.map +1 -1
- package/lib/types/options/shared-parsing.d.ts +50 -0
- package/lib/types/options/shared-parsing.d.ts.map +1 -0
- package/lib/types/options/version-parsing.d.ts +184 -0
- package/lib/types/options/version-parsing.d.ts.map +1 -0
- package/lib/types/options/vertexai.d.ts +3 -11
- package/lib/types/options/vertexai.d.ts.map +1 -1
- package/lib/types/types.d.ts +2 -0
- package/lib/types/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/index.ts +2 -1
- package/src/options/bedrock.ts +46 -80
- package/src/options/context-windows.ts +1 -0
- package/src/options/openai.ts +28 -6
- package/src/options/shared-parsing.ts +144 -0
- package/src/options/version-parsing.ts +360 -0
- package/src/options/vertexai.ts +46 -211
- package/src/types.ts +4 -1
package/src/options/bedrock.ts
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { type ModelOptionInfoItem, type ModelOptions, type ModelOptionsInfo, OptionType } from "../types.js";
|
|
2
|
+
import {
|
|
3
|
+
buildClaudeCacheOptions,
|
|
4
|
+
buildClaudeCacheTtlOptions,
|
|
5
|
+
buildClaudeEffortOptions,
|
|
6
|
+
buildClaudeIncludeThoughtsOption,
|
|
7
|
+
buildClaudeThinkingBudgetOption,
|
|
8
|
+
getClaudeMaxTokensLimit,
|
|
9
|
+
} from "./shared-parsing.js";
|
|
10
|
+
import { hasSamplingParameterRestriction } from "./version-parsing.js";
|
|
4
11
|
|
|
5
12
|
// Union type of all Bedrock options
|
|
6
13
|
export type BedrockOptions = NovaCanvasOptions | BaseConverseOptions | BedrockClaudeOptions | BedrockPalmyraOptions | BedrockGptOssOptions | TwelvelabsPegasusOptions;
|
|
@@ -32,9 +39,9 @@ export interface BaseConverseOptions {
|
|
|
32
39
|
export interface BedrockClaudeOptions extends BaseConverseOptions {
|
|
33
40
|
_option_id: "bedrock-claude";
|
|
34
41
|
top_k?: number;
|
|
35
|
-
thinking_mode?: boolean;
|
|
36
42
|
thinking_budget_tokens?: number;
|
|
37
43
|
include_thoughts?: boolean;
|
|
44
|
+
effort?: 'low' | 'medium' | 'high' | 'xhigh' | 'max';
|
|
38
45
|
cache_enabled?: boolean;
|
|
39
46
|
cache_ttl?: '5m' | '1h';
|
|
40
47
|
}
|
|
@@ -61,11 +68,9 @@ export interface TwelvelabsPegasusOptions {
|
|
|
61
68
|
}
|
|
62
69
|
|
|
63
70
|
export function getMaxTokensLimitBedrock(model: string): number | undefined {
|
|
64
|
-
// Claude models — delegate to
|
|
65
|
-
// override only where Bedrock supports extended output (128K for 3.7)
|
|
71
|
+
// Claude models — delegate to shared limit logic (128K for 3.7 and Opus 4.7+)
|
|
66
72
|
if (model.includes("claude")) {
|
|
67
|
-
|
|
68
|
-
return getMaxOutputTokens(model);
|
|
73
|
+
return getClaudeMaxTokensLimit(model);
|
|
69
74
|
}
|
|
70
75
|
// Amazon models
|
|
71
76
|
else if (model.includes("amazon")) {
|
|
@@ -229,6 +234,9 @@ export function getBedrockOptions(model: string, option?: ModelOptions): ModelOp
|
|
|
229
234
|
} else {
|
|
230
235
|
const max_tokens_limit = getMaxTokensLimitBedrock(model);
|
|
231
236
|
//Not canvas, i.e normal AWS bedrock converse
|
|
237
|
+
// Opus 4.7+ models no longer support temperature, top_p, top_k (returns 400 error)
|
|
238
|
+
// Opus 4.6 and Sonnet 4.6 still support these parameters
|
|
239
|
+
const hasSamplingRestriction = hasSamplingParameterRestriction(model);
|
|
232
240
|
const baseConverseOptions: ModelOptionInfoItem[] = [
|
|
233
241
|
{
|
|
234
242
|
name: "max_tokens",
|
|
@@ -239,31 +247,38 @@ export function getBedrockOptions(model: string, option?: ModelOptions): ModelOp
|
|
|
239
247
|
step: 200,
|
|
240
248
|
description: "The maximum number of tokens to generate",
|
|
241
249
|
},
|
|
242
|
-
|
|
250
|
+
];
|
|
251
|
+
|
|
252
|
+
// Opus 4.7+ models don't support temperature, top_p
|
|
253
|
+
if (!hasSamplingRestriction) {
|
|
254
|
+
baseConverseOptions.push({
|
|
243
255
|
name: "temperature",
|
|
244
256
|
type: OptionType.numeric,
|
|
245
257
|
min: 0.0,
|
|
246
258
|
default: 0.7,
|
|
247
259
|
step: 0.1,
|
|
248
260
|
description: "A higher temperature biases toward less likely tokens, making the model more creative"
|
|
249
|
-
}
|
|
250
|
-
{
|
|
261
|
+
});
|
|
262
|
+
baseConverseOptions.push({
|
|
251
263
|
name: "top_p",
|
|
252
264
|
type: OptionType.numeric,
|
|
253
265
|
min: 0,
|
|
254
266
|
max: 1,
|
|
255
267
|
step: 0.1,
|
|
256
268
|
description: "Limits token sampling to the cumulative probability of the top p tokens"
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
baseConverseOptions.push({
|
|
273
|
+
name: "stop_sequence",
|
|
274
|
+
type: OptionType.string_list,
|
|
275
|
+
value: [],
|
|
276
|
+
description: "The generation will halt if one of the stop sequences is output"
|
|
277
|
+
});
|
|
264
278
|
|
|
265
279
|
if (model.includes("claude")) {
|
|
266
|
-
|
|
280
|
+
// Opus 4.7+ models don't support top_k
|
|
281
|
+
const claudeConverseOptions: ModelOptionInfoItem[] = hasSamplingRestriction ? [] : [
|
|
267
282
|
{
|
|
268
283
|
name: "top_k",
|
|
269
284
|
type: OptionType.numeric,
|
|
@@ -273,66 +288,18 @@ export function getBedrockOptions(model: string, option?: ModelOptions): ModelOp
|
|
|
273
288
|
description: "Limits token sampling to the top k tokens"
|
|
274
289
|
},
|
|
275
290
|
];
|
|
276
|
-
const claudeCacheOptions: ModelOptionInfoItem[] = [
|
|
277
|
-
{
|
|
278
|
-
name: "cache_enabled",
|
|
279
|
-
type: OptionType.boolean,
|
|
280
|
-
default: false,
|
|
281
|
-
description: "Enable prompt caching. Injects cache breakpoints at the system prompt, tools, and conversation pivot.",
|
|
282
|
-
},
|
|
283
|
-
];
|
|
284
|
-
const claudeCacheTtlOptions: ModelOptionInfoItem[] = (option as BedrockClaudeOptions)?.cache_enabled ? [
|
|
285
|
-
{
|
|
286
|
-
name: "cache_ttl",
|
|
287
|
-
type: OptionType.enum,
|
|
288
|
-
enum: { "5 minutes (default)": "5m", "1 hour": "1h" },
|
|
289
|
-
default: "5m",
|
|
290
|
-
description: "TTL for cache breakpoints. '1h' requires extended caching to be enabled on your account.",
|
|
291
|
-
}
|
|
292
|
-
] : [];
|
|
293
|
-
if (model.includes("-3-7-") || model.includes("-4-")) {
|
|
294
|
-
const claudeModeOptions: ModelOptionInfoItem[] = [
|
|
295
|
-
{
|
|
296
|
-
name: "thinking_mode",
|
|
297
|
-
type: OptionType.boolean,
|
|
298
|
-
default: false,
|
|
299
|
-
description: "If true, use the extended reasoning mode"
|
|
300
|
-
},
|
|
301
|
-
];
|
|
302
|
-
const claudeThinkingOptions: ModelOptionInfoItem[] = (option as BedrockClaudeOptions)?.thinking_mode ? [
|
|
303
|
-
{
|
|
304
|
-
name: "thinking_budget_tokens",
|
|
305
|
-
type: OptionType.numeric,
|
|
306
|
-
min: 1024,
|
|
307
|
-
default: 1024,
|
|
308
|
-
integer: true,
|
|
309
|
-
step: 100,
|
|
310
|
-
description: "The target number of tokens to use for reasoning, not a hard limit."
|
|
311
|
-
},
|
|
312
|
-
{
|
|
313
|
-
name: "include_thoughts",
|
|
314
|
-
type: OptionType.boolean,
|
|
315
|
-
default: false,
|
|
316
|
-
description: "If true, include the reasoning in the response"
|
|
317
|
-
},
|
|
318
|
-
] : [];
|
|
319
|
-
|
|
320
|
-
return {
|
|
321
|
-
_option_id: "bedrock-claude",
|
|
322
|
-
options: [
|
|
323
|
-
...baseConverseOptions,
|
|
324
|
-
...claudeConverseOptions,
|
|
325
|
-
...claudeModeOptions,
|
|
326
|
-
...claudeThinkingOptions,
|
|
327
|
-
...claudeCacheOptions,
|
|
328
|
-
...claudeCacheTtlOptions,
|
|
329
|
-
]
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
291
|
return {
|
|
333
292
|
_option_id: "bedrock-claude",
|
|
334
|
-
options: [
|
|
335
|
-
|
|
293
|
+
options: [
|
|
294
|
+
...baseConverseOptions,
|
|
295
|
+
...claudeConverseOptions,
|
|
296
|
+
...buildClaudeEffortOptions(model),
|
|
297
|
+
...buildClaudeThinkingBudgetOption(model),
|
|
298
|
+
...buildClaudeIncludeThoughtsOption(model),
|
|
299
|
+
...buildClaudeCacheOptions(),
|
|
300
|
+
...buildClaudeCacheTtlOptions((option as BedrockClaudeOptions)?.cache_enabled),
|
|
301
|
+
],
|
|
302
|
+
};
|
|
336
303
|
}
|
|
337
304
|
else if (model.includes("amazon")) {
|
|
338
305
|
//Titan models also exists but does not support any additional options
|
|
@@ -527,7 +494,7 @@ export function getBedrockOptions(model: string, option?: ModelOptions): ModelOp
|
|
|
527
494
|
_option_id: "bedrock-twelvelabs-pegasus",
|
|
528
495
|
options: pegasusOptions
|
|
529
496
|
};
|
|
530
|
-
}
|
|
497
|
+
}
|
|
531
498
|
}
|
|
532
499
|
|
|
533
500
|
//Fallback to converse standard.
|
|
@@ -536,5 +503,4 @@ export function getBedrockOptions(model: string, option?: ModelOptions): ModelOp
|
|
|
536
503
|
options: baseConverseOptions
|
|
537
504
|
};
|
|
538
505
|
}
|
|
539
|
-
|
|
540
|
-
}
|
|
506
|
+
}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
export function getMaxOutputTokens(model: string): number {
|
|
7
7
|
// Claude models
|
|
8
8
|
if (model.includes('claude')) {
|
|
9
|
+
if (model.includes('opus-4-7')) return 128_000;
|
|
9
10
|
if (model.includes('opus-4-6')) return 128_000;
|
|
10
11
|
if (model.includes('opus-4-5')) return 64_000;
|
|
11
12
|
if (model.includes('opus-')) return 32_768; // Opus 4.0, 4.1
|
package/src/options/openai.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ModelOptionInfoItem, ModelOptions, ModelOptionsInfo, OptionType, SharedOptions } from "../types.js";
|
|
1
|
+
import { ModelOptionInfoItem, ModelOptions, ModelOptionsInfo, OptionType, ReasoningEffort, SharedOptions } from "../types.js";
|
|
2
2
|
import { textOptionsFallback } from "./fallback.js";
|
|
3
3
|
|
|
4
4
|
// Union type of all OpenAI options
|
|
@@ -8,7 +8,8 @@ export interface OpenAiThinkingOptions {
|
|
|
8
8
|
_option_id: "openai-thinking",
|
|
9
9
|
max_tokens?: number,
|
|
10
10
|
stop_sequence?: string[],
|
|
11
|
-
|
|
11
|
+
effort?: ReasoningEffort,
|
|
12
|
+
reasoning_effort?: ReasoningEffort,
|
|
12
13
|
image_detail?: "low" | "high" | "auto",
|
|
13
14
|
}
|
|
14
15
|
|
|
@@ -150,7 +151,7 @@ export function getOpenAiOptions(model: string, _option?: ModelOptions): ModelOp
|
|
|
150
151
|
};
|
|
151
152
|
}
|
|
152
153
|
|
|
153
|
-
if (
|
|
154
|
+
if (isReasoningModel(model)) {
|
|
154
155
|
//Is thinking text model
|
|
155
156
|
let max_tokens_limit = 4096;
|
|
156
157
|
if (model.includes("o1")) {
|
|
@@ -167,6 +168,9 @@ export function getOpenAiOptions(model: string, _option?: ModelOptions): ModelOp
|
|
|
167
168
|
else if (model.includes("o3")) {
|
|
168
169
|
max_tokens_limit = 100000;
|
|
169
170
|
}
|
|
171
|
+
else if (model.includes("o4") || model.includes("gpt-5")) {
|
|
172
|
+
max_tokens_limit = 128000;
|
|
173
|
+
}
|
|
170
174
|
|
|
171
175
|
const commonOptions: ModelOptionInfoItem[] = [
|
|
172
176
|
{
|
|
@@ -179,9 +183,14 @@ export function getOpenAiOptions(model: string, _option?: ModelOptions): ModelOp
|
|
|
179
183
|
},
|
|
180
184
|
];
|
|
181
185
|
|
|
182
|
-
const reasoningOptions: ModelOptionInfoItem[] =
|
|
186
|
+
const reasoningOptions: ModelOptionInfoItem[] = isGpt5ProModel(model) ? [
|
|
183
187
|
{
|
|
184
|
-
name:
|
|
188
|
+
name: SharedOptions.effort, type: OptionType.enum, enum: { "High": "high" },
|
|
189
|
+
default: "high", description: "GPT-5 Pro only supports high reasoning effort."
|
|
190
|
+
},
|
|
191
|
+
] : model.includes("o3") || model.includes("o4") || model.includes("gpt-5") || isO1Full(model) ? [
|
|
192
|
+
{
|
|
193
|
+
name: SharedOptions.effort, type: OptionType.enum, enum: { "Low": "low", "Medium": "medium", "High": "high" },
|
|
185
194
|
default: "medium", description: "How much effort the model should put into reasoning, lower values result in faster responses and less tokens used."
|
|
186
195
|
},
|
|
187
196
|
] : [];
|
|
@@ -265,10 +274,23 @@ function isO1Full(model: string): boolean {
|
|
|
265
274
|
return false;
|
|
266
275
|
}
|
|
267
276
|
|
|
277
|
+
function isReasoningModel(model: string): boolean {
|
|
278
|
+
const normalized = model.toLowerCase();
|
|
279
|
+
return normalized.includes("o1")
|
|
280
|
+
|| normalized.includes("o3")
|
|
281
|
+
|| normalized.includes("o4")
|
|
282
|
+
|| normalized.includes("gpt-5");
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
function isGpt5ProModel(model: string): boolean {
|
|
286
|
+
const modelName = model.toLowerCase().split('/').pop() ?? model.toLowerCase();
|
|
287
|
+
return /^gpt-5(?:\.\d+)?-pro/.test(modelName);
|
|
288
|
+
}
|
|
289
|
+
|
|
268
290
|
function isVisionModel(model: string): boolean {
|
|
269
291
|
return model.includes("gpt-4o") || isO1Full(model) || model.includes("gpt-4-turbo");
|
|
270
292
|
}
|
|
271
293
|
|
|
272
294
|
function isImageModel(model: string): boolean {
|
|
273
295
|
return model.includes("dall-e") || model.includes("gpt-image") || model.includes("chatgpt-image");
|
|
274
|
-
}
|
|
296
|
+
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared Claude option builders used by multiple providers (Bedrock, VertexAI, …).
|
|
3
|
+
*
|
|
4
|
+
* Centralising these helpers means a single edit propagates to all drivers, and
|
|
5
|
+
* the per-provider files stay focused on provider-specific concerns (base options,
|
|
6
|
+
* max-tokens limits for non-Claude models, etc.).
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { type ModelOptionInfoItem, OptionType } from "../types.js";
|
|
10
|
+
import { getMaxOutputTokens } from "./context-windows.js";
|
|
11
|
+
import {
|
|
12
|
+
getAvailableEffortLevels,
|
|
13
|
+
isClaudeVersionGTE,
|
|
14
|
+
supportsAdaptiveThinking,
|
|
15
|
+
} from "./version-parsing.js";
|
|
16
|
+
|
|
17
|
+
// ============================================================================
|
|
18
|
+
// Max tokens
|
|
19
|
+
// ============================================================================
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Canonical max output-tokens limit for Claude models, shared by all providers.
|
|
23
|
+
*
|
|
24
|
+
* - Claude 3.7: 128 K (all providers support extended output)
|
|
25
|
+
* - Claude Opus 4.7+: 128 K
|
|
26
|
+
* - All others: delegated to {@link getMaxOutputTokens}
|
|
27
|
+
*/
|
|
28
|
+
export function getClaudeMaxTokensLimit(model: string): number {
|
|
29
|
+
if (model.includes('-3-7')) return 128000;
|
|
30
|
+
if (model.includes('opus-4-7')) return 128000;
|
|
31
|
+
return getMaxOutputTokens(model);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// ============================================================================
|
|
35
|
+
// Cache options
|
|
36
|
+
// ============================================================================
|
|
37
|
+
|
|
38
|
+
/** cache_enabled toggle — identical across providers. */
|
|
39
|
+
export function buildClaudeCacheOptions(): ModelOptionInfoItem[] {
|
|
40
|
+
return [
|
|
41
|
+
{
|
|
42
|
+
name: "cache_enabled",
|
|
43
|
+
type: OptionType.boolean,
|
|
44
|
+
default: false,
|
|
45
|
+
description: "Enable prompt caching. Injects cache breakpoints at the system prompt, tools, and conversation pivot.",
|
|
46
|
+
},
|
|
47
|
+
];
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* cache_ttl selector — only shown when caching is enabled.
|
|
52
|
+
* Pass `option?.cache_enabled` from the current saved options.
|
|
53
|
+
*/
|
|
54
|
+
export function buildClaudeCacheTtlOptions(cacheEnabled?: boolean): ModelOptionInfoItem[] {
|
|
55
|
+
if (!cacheEnabled) return [];
|
|
56
|
+
return [
|
|
57
|
+
{
|
|
58
|
+
name: "cache_ttl",
|
|
59
|
+
type: OptionType.enum,
|
|
60
|
+
enum: { "5 minutes (default)": "5m", "1 hour": "1h" },
|
|
61
|
+
default: "5m",
|
|
62
|
+
description: "TTL for cache breakpoints. '1h' requires extended caching to be enabled on your account.",
|
|
63
|
+
},
|
|
64
|
+
];
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// ============================================================================
|
|
68
|
+
// Effort option
|
|
69
|
+
// ============================================================================
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Effort selector — shown only for models that support it (Opus 4.5+, Sonnet 4.6+, all 4.7+).
|
|
73
|
+
* Returns an empty array for unsupported models.
|
|
74
|
+
*/
|
|
75
|
+
export function buildClaudeEffortOptions(model: string): ModelOptionInfoItem[] {
|
|
76
|
+
const effortLevels = getAvailableEffortLevels(model);
|
|
77
|
+
if (!effortLevels) return [];
|
|
78
|
+
return [
|
|
79
|
+
{
|
|
80
|
+
name: "effort",
|
|
81
|
+
type: OptionType.enum,
|
|
82
|
+
enum: effortLevels,
|
|
83
|
+
description: "Controls how many tokens Claude uses when responding. Lower effort trades thoroughness for speed and cost savings.",
|
|
84
|
+
},
|
|
85
|
+
];
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// ============================================================================
|
|
89
|
+
// Thinking / reasoning options
|
|
90
|
+
// ============================================================================
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Thinking budget option — shown for non-adaptive Claude thinking models (3.7, 4.5).
|
|
94
|
+
* Setting this enables extended thinking with the given token budget.
|
|
95
|
+
*
|
|
96
|
+
* Returns an empty array for models that don't support extended thinking or that
|
|
97
|
+
* use adaptive thinking instead (where effort is the control knob).
|
|
98
|
+
*/
|
|
99
|
+
export function buildClaudeThinkingBudgetOption(model: string): ModelOptionInfoItem[] {
|
|
100
|
+
// Adaptive-only models (Opus 4.7+) don't accept budget_tokens at all.
|
|
101
|
+
// Adaptive models (Opus/Sonnet 4.6) still accept budget_tokens but it's deprecated;
|
|
102
|
+
// those models should use effort instead. Show budget only for non-adaptive thinking models.
|
|
103
|
+
if (!isClaudeVersionGTE(model, 3, 7) || supportsAdaptiveThinking(model)) return [];
|
|
104
|
+
return [
|
|
105
|
+
{
|
|
106
|
+
name: "thinking_budget_tokens",
|
|
107
|
+
type: OptionType.numeric,
|
|
108
|
+
min: 1024,
|
|
109
|
+
integer: true,
|
|
110
|
+
step: 1024,
|
|
111
|
+
description: "Token budget for extended thinking. Enables thinking when set.",
|
|
112
|
+
},
|
|
113
|
+
];
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* include_thoughts display toggle — shown for all Claude thinking-capable models.
|
|
118
|
+
* Controls whether thinking content is returned in the response.
|
|
119
|
+
* This does not enable thinking; set thinking_budget_tokens (extended) or effort (adaptive).
|
|
120
|
+
*
|
|
121
|
+
* Returns an empty array for models with no thinking support.
|
|
122
|
+
*/
|
|
123
|
+
export function buildClaudeIncludeThoughtsOption(model: string): ModelOptionInfoItem[] {
|
|
124
|
+
if (!isClaudeVersionGTE(model, 3, 7)) return [];
|
|
125
|
+
return [
|
|
126
|
+
{
|
|
127
|
+
name: "include_thoughts",
|
|
128
|
+
type: OptionType.boolean,
|
|
129
|
+
default: false,
|
|
130
|
+
description: "Include the model's thinking content in the response.",
|
|
131
|
+
},
|
|
132
|
+
];
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* @deprecated Use buildClaudeThinkingBudgetOption and buildClaudeIncludeThoughtsOption separately.
|
|
137
|
+
* Kept for backwards compatibility — delegates to the two new helpers.
|
|
138
|
+
*/
|
|
139
|
+
export function buildClaudeThinkingOptions(model: string): ModelOptionInfoItem[] {
|
|
140
|
+
return [
|
|
141
|
+
...buildClaudeThinkingBudgetOption(model),
|
|
142
|
+
...buildClaudeIncludeThoughtsOption(model),
|
|
143
|
+
];
|
|
144
|
+
}
|