@llumiverse/common 1.3.0 → 1.4.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/capability/anthropic.d.ts +3 -0
- package/lib/capability/anthropic.d.ts.map +1 -0
- package/lib/capability/anthropic.js +92 -0
- package/lib/capability/anthropic.js.map +1 -0
- package/lib/{types/capability → capability}/azure_foundry.d.ts +1 -1
- package/lib/capability/azure_foundry.d.ts.map +1 -0
- package/lib/capability/azure_foundry.js +394 -0
- package/lib/capability/azure_foundry.js.map +1 -0
- package/lib/{types/capability → capability}/bedrock.d.ts +1 -1
- package/lib/capability/bedrock.d.ts.map +1 -0
- package/lib/capability/bedrock.js +300 -0
- package/lib/capability/bedrock.js.map +1 -0
- package/lib/{types/capability → capability}/openai.d.ts +1 -1
- package/lib/capability/openai.d.ts.map +1 -0
- package/lib/capability/openai.js +179 -0
- package/lib/capability/openai.js.map +1 -0
- package/lib/{types/capability → capability}/vertexai.d.ts +1 -1
- package/lib/capability/vertexai.d.ts.map +1 -0
- package/lib/capability/vertexai.js +137 -0
- package/lib/capability/vertexai.js.map +1 -0
- package/lib/{types/capability.d.ts → capability.d.ts} +1 -1
- package/lib/capability.d.ts.map +1 -0
- package/lib/{esm/capability.js → capability.js} +17 -17
- package/lib/capability.js.map +1 -0
- package/lib/index.d.ts +14 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +14 -0
- package/lib/index.js.map +1 -0
- package/lib/{types/options → options}/anthropic.d.ts +2 -2
- package/lib/options/anthropic.d.ts.map +1 -0
- package/lib/{esm/options → options}/anthropic.js +14 -11
- package/lib/options/anthropic.js.map +1 -0
- package/lib/{types/options → options}/azure_foundry.d.ts +14 -14
- package/lib/options/azure_foundry.d.ts.map +1 -0
- package/lib/{esm/options → options}/azure_foundry.js +126 -126
- package/lib/options/azure_foundry.js.map +1 -0
- package/lib/{types/options → options}/bedrock.d.ts +16 -16
- package/lib/{types/options → options}/bedrock.d.ts.map +1 -1
- package/lib/options/bedrock.js +489 -0
- package/lib/options/bedrock.js.map +1 -0
- package/lib/options/context-windows.d.ts.map +1 -0
- package/lib/options/context-windows.js.map +1 -0
- package/lib/options/embedding.d.ts +38 -0
- package/lib/options/embedding.d.ts.map +1 -0
- package/lib/options/embedding.js +77 -0
- package/lib/options/embedding.js.map +1 -0
- package/lib/{types/options → options}/fallback.d.ts +2 -2
- package/lib/options/fallback.d.ts.map +1 -0
- package/lib/options/fallback.js +65 -0
- package/lib/options/fallback.js.map +1 -0
- package/lib/{types/options → options}/groq.d.ts +2 -2
- package/lib/options/groq.d.ts.map +1 -0
- package/lib/options/groq.js +54 -0
- package/lib/options/groq.js.map +1 -0
- package/lib/options/openai.d.ts +40 -0
- package/lib/options/openai.d.ts.map +1 -0
- package/lib/options/openai.js +284 -0
- package/lib/options/openai.js.map +1 -0
- package/lib/{types/options → options}/shared-parsing.d.ts +1 -1
- package/lib/options/shared-parsing.d.ts.map +1 -0
- package/lib/{esm/options → options}/shared-parsing.js +14 -17
- package/lib/options/shared-parsing.js.map +1 -0
- package/lib/options/version-parsing.d.ts.map +1 -0
- package/lib/{esm/options → options}/version-parsing.js +15 -15
- package/lib/options/version-parsing.js.map +1 -0
- package/lib/{types/options → options}/vertexai.d.ts +15 -15
- package/lib/options/vertexai.d.ts.map +1 -0
- package/lib/options/vertexai.js +606 -0
- package/lib/options/vertexai.js.map +1 -0
- package/lib/{types/options.d.ts → options.d.ts} +1 -1
- package/lib/options.d.ts.map +1 -0
- package/lib/{esm/options.js → options.js} +8 -8
- package/lib/options.js.map +1 -0
- package/lib/{types/types.d.ts → types.d.ts} +143 -35
- package/lib/types.d.ts.map +1 -0
- package/lib/{esm/types.js → types.js} +21 -23
- package/lib/types.js.map +1 -0
- package/package.json +11 -34
- package/src/LlumiverseError.test.ts +18 -72
- package/src/capability/anthropic.ts +61 -11
- package/src/capability/azure_foundry.ts +303 -65
- package/src/capability/bedrock.ts +201 -56
- package/src/capability/openai.ts +135 -41
- package/src/capability/vertexai.ts +105 -35
- package/src/capability.ts +18 -18
- package/src/index.ts +13 -12
- package/src/options/anthropic.ts +16 -13
- package/src/options/azure_foundry.ts +157 -143
- package/src/options/bedrock.ts +247 -185
- package/src/options/context-windows.ts +2 -2
- package/src/options/embedding.ts +92 -0
- package/src/options/fallback.ts +50 -17
- package/src/options/groq.ts +48 -21
- package/src/options/openai.ts +228 -183
- package/src/options/shared-parsing.ts +16 -21
- package/src/options/version-parsing.ts +17 -17
- package/src/options/vertexai.ts +382 -288
- package/src/options.ts +8 -8
- package/src/types.ts +260 -155
- package/lib/cjs/capability/anthropic.js +0 -45
- package/lib/cjs/capability/anthropic.js.map +0 -1
- package/lib/cjs/capability/azure_foundry.js +0 -160
- package/lib/cjs/capability/azure_foundry.js.map +0 -1
- package/lib/cjs/capability/bedrock.js +0 -158
- package/lib/cjs/capability/bedrock.js.map +0 -1
- package/lib/cjs/capability/openai.js +0 -98
- package/lib/cjs/capability/openai.js.map +0 -1
- package/lib/cjs/capability/vertexai.js +0 -80
- package/lib/cjs/capability/vertexai.js.map +0 -1
- package/lib/cjs/capability.js +0 -115
- package/lib/cjs/capability.js.map +0 -1
- package/lib/cjs/index.js +0 -29
- package/lib/cjs/index.js.map +0 -1
- package/lib/cjs/options/anthropic.js +0 -34
- package/lib/cjs/options/anthropic.js.map +0 -1
- package/lib/cjs/options/azure_foundry.js +0 -423
- package/lib/cjs/options/azure_foundry.js.map +0 -1
- package/lib/cjs/options/bedrock.js +0 -427
- package/lib/cjs/options/bedrock.js.map +0 -1
- package/lib/cjs/options/context-windows.js +0 -138
- package/lib/cjs/options/context-windows.js.map +0 -1
- package/lib/cjs/options/fallback.js +0 -35
- package/lib/cjs/options/fallback.js.map +0 -1
- package/lib/cjs/options/groq.js +0 -37
- package/lib/cjs/options/groq.js.map +0 -1
- package/lib/cjs/options/openai.js +0 -246
- package/lib/cjs/options/openai.js.map +0 -1
- package/lib/cjs/options/shared-parsing.js +0 -144
- package/lib/cjs/options/shared-parsing.js.map +0 -1
- package/lib/cjs/options/version-parsing.js +0 -326
- package/lib/cjs/options/version-parsing.js.map +0 -1
- package/lib/cjs/options/vertexai.js +0 -525
- package/lib/cjs/options/vertexai.js.map +0 -1
- package/lib/cjs/options.js +0 -33
- package/lib/cjs/options.js.map +0 -1
- package/lib/cjs/package.json +0 -3
- package/lib/cjs/types.js +0 -307
- package/lib/cjs/types.js.map +0 -1
- package/lib/esm/capability/anthropic.js +0 -42
- package/lib/esm/capability/anthropic.js.map +0 -1
- package/lib/esm/capability/azure_foundry.js +0 -157
- package/lib/esm/capability/azure_foundry.js.map +0 -1
- package/lib/esm/capability/bedrock.js +0 -155
- package/lib/esm/capability/bedrock.js.map +0 -1
- package/lib/esm/capability/openai.js +0 -95
- package/lib/esm/capability/openai.js.map +0 -1
- package/lib/esm/capability/vertexai.js +0 -77
- package/lib/esm/capability/vertexai.js.map +0 -1
- package/lib/esm/capability.js.map +0 -1
- package/lib/esm/index.js +0 -13
- package/lib/esm/index.js.map +0 -1
- package/lib/esm/options/anthropic.js.map +0 -1
- package/lib/esm/options/azure_foundry.js.map +0 -1
- package/lib/esm/options/bedrock.js +0 -423
- package/lib/esm/options/bedrock.js.map +0 -1
- package/lib/esm/options/context-windows.js.map +0 -1
- package/lib/esm/options/fallback.js +0 -32
- package/lib/esm/options/fallback.js.map +0 -1
- package/lib/esm/options/groq.js +0 -34
- package/lib/esm/options/groq.js.map +0 -1
- package/lib/esm/options/openai.js +0 -243
- package/lib/esm/options/openai.js.map +0 -1
- package/lib/esm/options/shared-parsing.js.map +0 -1
- package/lib/esm/options/version-parsing.js.map +0 -1
- package/lib/esm/options/vertexai.js +0 -519
- package/lib/esm/options/vertexai.js.map +0 -1
- package/lib/esm/options.js.map +0 -1
- package/lib/esm/types.js.map +0 -1
- package/lib/types/capability/anthropic.d.ts +0 -3
- package/lib/types/capability/anthropic.d.ts.map +0 -1
- package/lib/types/capability/azure_foundry.d.ts.map +0 -1
- package/lib/types/capability/bedrock.d.ts.map +0 -1
- package/lib/types/capability/openai.d.ts.map +0 -1
- package/lib/types/capability/vertexai.d.ts.map +0 -1
- package/lib/types/capability.d.ts.map +0 -1
- package/lib/types/index.d.ts +0 -13
- package/lib/types/index.d.ts.map +0 -1
- package/lib/types/options/anthropic.d.ts.map +0 -1
- package/lib/types/options/azure_foundry.d.ts.map +0 -1
- package/lib/types/options/context-windows.d.ts.map +0 -1
- package/lib/types/options/fallback.d.ts.map +0 -1
- package/lib/types/options/groq.d.ts.map +0 -1
- package/lib/types/options/openai.d.ts +0 -40
- package/lib/types/options/openai.d.ts.map +0 -1
- package/lib/types/options/shared-parsing.d.ts.map +0 -1
- package/lib/types/options/version-parsing.d.ts.map +0 -1
- package/lib/types/options/vertexai.d.ts.map +0 -1
- package/lib/types/options.d.ts.map +0 -1
- package/lib/types/types.d.ts.map +0 -1
- /package/lib/{types/options → options}/context-windows.d.ts +0 -0
- /package/lib/{esm/options → options}/context-windows.js +0 -0
- /package/lib/{types/options → options}/version-parsing.d.ts +0 -0
|
@@ -1,326 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Version parsing utilities for Claude and Gemini models.
|
|
4
|
-
*
|
|
5
|
-
* Provides version detection helpers that are forward-compatible with future
|
|
6
|
-
* model releases (e.g., Haiku 4.7, Sonnet 4.7, Opus 4.8, Opus 5).
|
|
7
|
-
*
|
|
8
|
-
* These helpers are used to:
|
|
9
|
-
* - Control option visibility in the UI
|
|
10
|
-
* - Construct appropriate API payloads for each model version
|
|
11
|
-
*
|
|
12
|
-
* Note: llumiverse does NOT validate options here. Errors from invalid
|
|
13
|
-
* parameters propagate to the provider side.
|
|
14
|
-
*/
|
|
15
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.parseClaudeVersion = parseClaudeVersion;
|
|
17
|
-
exports.isClaudeVersionGTE = isClaudeVersionGTE;
|
|
18
|
-
exports.hasSamplingParameterRemoval = hasSamplingParameterRemoval;
|
|
19
|
-
exports.requiresAdaptiveThinking = requiresAdaptiveThinking;
|
|
20
|
-
exports.supportsAdaptiveThinking = supportsAdaptiveThinking;
|
|
21
|
-
exports.isExtendedThinkingDeprecated = isExtendedThinkingDeprecated;
|
|
22
|
-
exports.requiresAdaptiveThinkingOnly = requiresAdaptiveThinkingOnly;
|
|
23
|
-
exports.hasSamplingParameterRestriction = hasSamplingParameterRestriction;
|
|
24
|
-
exports.supportsEffort = supportsEffort;
|
|
25
|
-
exports.supportsXHighEffort = supportsXHighEffort;
|
|
26
|
-
exports.getAvailableEffortLevels = getAvailableEffortLevels;
|
|
27
|
-
exports.getGeminiModelVersion = getGeminiModelVersion;
|
|
28
|
-
exports.parseGeminiVersion = parseGeminiVersion;
|
|
29
|
-
exports.isGeminiModelVersionGte = isGeminiModelVersionGte;
|
|
30
|
-
/**
|
|
31
|
-
* Parse Claude model version from a model string.
|
|
32
|
-
*
|
|
33
|
-
* Examples:
|
|
34
|
-
* - "claude-opus-4-7" -> { major: 4, minor: 7, variant: 'opus' }
|
|
35
|
-
* - "claude-sonnet-4-6" -> { major: 4, minor: 6, variant: 'sonnet' }
|
|
36
|
-
* - "claude-3-7-sonnet-20250219" -> { major: 3, minor: 7, variant: 'sonnet' }
|
|
37
|
-
* - "claude-opus-4-6" -> { major: 4, minor: 6, variant: 'opus' }
|
|
38
|
-
*
|
|
39
|
-
* @param modelString - The model identifier string
|
|
40
|
-
* @returns Parsed version info, or null if not parseable
|
|
41
|
-
*/
|
|
42
|
-
function parseClaudeVersion(modelString) {
|
|
43
|
-
// Match pattern: claude-[variant-]-{major}-[optional minor]
|
|
44
|
-
// The minor version is limited to 1-2 digits to avoid matching dates (YYYYMMDD format)
|
|
45
|
-
const match = modelString.match(/claude-(opus|sonnet|haiku)-?(\d+)(?:-(\d{1,2}))?(?:-|\b)/i);
|
|
46
|
-
if (match) {
|
|
47
|
-
const variant = match[1].toLowerCase();
|
|
48
|
-
const major = parseInt(match[2], 10);
|
|
49
|
-
const minor = match[3] ? parseInt(match[3], 10) : 0;
|
|
50
|
-
return { major, minor, variant };
|
|
51
|
-
}
|
|
52
|
-
// Fallback for older format: claude-3-7-sonnet-20250219
|
|
53
|
-
const fallbackMatch = modelString.match(/claude-(\d+)-(\d+)-(\w+)/i);
|
|
54
|
-
if (fallbackMatch) {
|
|
55
|
-
const major = parseInt(fallbackMatch[1], 10);
|
|
56
|
-
const minor = parseInt(fallbackMatch[2], 10);
|
|
57
|
-
const variant = fallbackMatch[3].toLowerCase();
|
|
58
|
-
return { major, minor, variant };
|
|
59
|
-
}
|
|
60
|
-
return null;
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Check if a Claude model version is greater than or equal to a target version.
|
|
64
|
-
*
|
|
65
|
-
* @param modelString - The model identifier string
|
|
66
|
-
* @param targetMajor - Target major version
|
|
67
|
-
* @param targetMinor - Target minor version
|
|
68
|
-
* @returns true if the model version is >= target version, false otherwise
|
|
69
|
-
*/
|
|
70
|
-
function isClaudeVersionGTE(modelString, targetMajor, targetMinor) {
|
|
71
|
-
const version = parseClaudeVersion(modelString);
|
|
72
|
-
if (!version) {
|
|
73
|
-
return false;
|
|
74
|
-
}
|
|
75
|
-
if (version.major > targetMajor) {
|
|
76
|
-
return true;
|
|
77
|
-
}
|
|
78
|
-
if (version.major === targetMajor && version.minor >= targetMinor) {
|
|
79
|
-
return true;
|
|
80
|
-
}
|
|
81
|
-
return false;
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Check if a Claude variant model version is greater than or equal to a target version.
|
|
85
|
-
*
|
|
86
|
-
* @param modelString - The model identifier string
|
|
87
|
-
* @param variant - Model variant: "opus" or "sonnet"
|
|
88
|
-
* @param targetMajor - Target major version
|
|
89
|
-
* @param targetMinor - Target minor version
|
|
90
|
-
* @returns true if the model matches the variant and version >= target
|
|
91
|
-
*/
|
|
92
|
-
function isClaudeVariantVersionGTE(modelString, variant, targetMajor, targetMinor) {
|
|
93
|
-
const version = parseClaudeVersion(modelString);
|
|
94
|
-
if (!version)
|
|
95
|
-
return false;
|
|
96
|
-
if (version.variant.toLowerCase() !== variant)
|
|
97
|
-
return false;
|
|
98
|
-
return version.major > targetMajor || (version.major === targetMajor && version.minor >= targetMinor);
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Check if a model requires sampling parameter removal (behavior: sampling params removed on Opus 4.7+).
|
|
102
|
-
*
|
|
103
|
-
* This includes:
|
|
104
|
-
* - claude-opus-4-7
|
|
105
|
-
* - Future Opus 4.x with minor >= 7
|
|
106
|
-
* - Future Opus 5.x+
|
|
107
|
-
*
|
|
108
|
-
* @param modelString - The model identifier string
|
|
109
|
-
* @returns true if Opus 4.7+ or equivalent future model
|
|
110
|
-
*/
|
|
111
|
-
function hasSamplingParameterRemoval(modelString) {
|
|
112
|
-
return isClaudeVariantVersionGTE(modelString, "opus", 4, 7);
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Check if a model requires adaptive thinking (behavior: adaptive thinking required on Opus 4.6+).
|
|
116
|
-
*
|
|
117
|
-
* This includes:
|
|
118
|
-
* - claude-opus-4-6
|
|
119
|
-
* - claude-opus-4-7
|
|
120
|
-
* - Future Opus 4.x with minor >= 6
|
|
121
|
-
* - Future Opus 5.x+
|
|
122
|
-
*
|
|
123
|
-
* @param modelString - The model identifier string
|
|
124
|
-
* @returns true if Opus 4.6+ or equivalent future model
|
|
125
|
-
*/
|
|
126
|
-
function requiresAdaptiveThinking(modelString) {
|
|
127
|
-
return isClaudeVariantVersionGTE(modelString, "opus", 4, 6);
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* Check if a model supports adaptive thinking.
|
|
131
|
-
*
|
|
132
|
-
* Adaptive thinking was introduced in:
|
|
133
|
-
* - Claude Opus 4.6
|
|
134
|
-
* - Claude Sonnet 4.6
|
|
135
|
-
*
|
|
136
|
-
* @param modelString - The model identifier string
|
|
137
|
-
* @returns true if the model supports adaptive thinking
|
|
138
|
-
*/
|
|
139
|
-
function supportsAdaptiveThinking(modelString) {
|
|
140
|
-
return requiresAdaptiveThinking(modelString) || isClaudeVariantVersionGTE(modelString, "sonnet", 4, 6);
|
|
141
|
-
}
|
|
142
|
-
/**
|
|
143
|
-
* Check if extended thinking is deprecated for this model.
|
|
144
|
-
*
|
|
145
|
-
* Extended thinking (thinking.type: "enabled" with budget_tokens) is deprecated
|
|
146
|
-
* but still functional on:
|
|
147
|
-
* - Claude Opus 4.6+
|
|
148
|
-
* - Claude Sonnet 4.6+
|
|
149
|
-
*
|
|
150
|
-
* @param modelString - The model identifier string
|
|
151
|
-
* @returns true if extended thinking is deprecated (adaptive thinking recommended)
|
|
152
|
-
*/
|
|
153
|
-
function isExtendedThinkingDeprecated(modelString) {
|
|
154
|
-
return supportsAdaptiveThinking(modelString);
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* Check if a model requires adaptive thinking ONLY (extended thinking removed).
|
|
158
|
-
*
|
|
159
|
-
* On Opus 4.7+, extended thinking returns a 400 error. Only adaptive thinking is supported.
|
|
160
|
-
* Future models (Sonnet 4.7+, Haiku 4.7+, any 5.0+) follow the same pattern.
|
|
161
|
-
*
|
|
162
|
-
* @param modelString - The model identifier string
|
|
163
|
-
* @returns true if extended thinking is removed (returns 400 error)
|
|
164
|
-
*/
|
|
165
|
-
function requiresAdaptiveThinkingOnly(modelString) {
|
|
166
|
-
return hasSamplingParameterRestriction(modelString);
|
|
167
|
-
}
|
|
168
|
-
/**
|
|
169
|
-
* Check if a model has sampling parameter restrictions.
|
|
170
|
-
*
|
|
171
|
-
* On Opus 4.7+, setting temperature, top_p, or top_k to any non-default value
|
|
172
|
-
* returns a 400 error. Future models following the same pattern will also match:
|
|
173
|
-
* - Opus 4.7+ (current restriction)
|
|
174
|
-
* - Sonnet 4.7+, Haiku 4.7+ (future minor versions >= 7)
|
|
175
|
-
* - Sonnet 5.0+, Haiku 5.0+, Opus 5.0+ (future major versions)
|
|
176
|
-
*
|
|
177
|
-
* @param modelString - The model identifier string
|
|
178
|
-
* @returns true if sampling parameters are restricted
|
|
179
|
-
*/
|
|
180
|
-
function hasSamplingParameterRestriction(modelString) {
|
|
181
|
-
const version = parseClaudeVersion(modelString);
|
|
182
|
-
if (!version) {
|
|
183
|
-
return false;
|
|
184
|
-
}
|
|
185
|
-
// Future major versions (5.0+) follow the same pattern as 4.7
|
|
186
|
-
if (version.major > 4) {
|
|
187
|
-
return true;
|
|
188
|
-
}
|
|
189
|
-
// Version 4.7+ (Opus 4.7, Sonnet 4.7, Haiku 4.7, etc.)
|
|
190
|
-
if (version.major === 4 && version.minor >= 7) {
|
|
191
|
-
return true;
|
|
192
|
-
}
|
|
193
|
-
return false;
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* Check if a model supports the effort parameter.
|
|
197
|
-
*
|
|
198
|
-
* Effort is supported on:
|
|
199
|
-
* - Claude Opus 4.5+
|
|
200
|
-
* - Claude Opus 4.6+
|
|
201
|
-
* - Claude Sonnet 4.6+
|
|
202
|
-
* - All variants at 4.7+ (Opus, Sonnet, Haiku)
|
|
203
|
-
* - All variants at 5.0+
|
|
204
|
-
*
|
|
205
|
-
* @param modelString - The model identifier string
|
|
206
|
-
* @returns true if the model supports the effort parameter
|
|
207
|
-
*/
|
|
208
|
-
function supportsEffort(modelString) {
|
|
209
|
-
// All 4.7+ variants support effort (covers future Sonnet 4.7, Haiku 4.7, etc.)
|
|
210
|
-
if (hasSamplingParameterRestriction(modelString)) {
|
|
211
|
-
return true;
|
|
212
|
-
}
|
|
213
|
-
// Opus 4.5+ supports effort
|
|
214
|
-
if (isClaudeVariantVersionGTE(modelString, "opus", 4, 5)) {
|
|
215
|
-
return true;
|
|
216
|
-
}
|
|
217
|
-
// Sonnet 4.6+ supports effort
|
|
218
|
-
if (isClaudeVariantVersionGTE(modelString, "sonnet", 4, 6)) {
|
|
219
|
-
return true;
|
|
220
|
-
}
|
|
221
|
-
return false;
|
|
222
|
-
}
|
|
223
|
-
/**
|
|
224
|
-
* Check if a model supports the xhigh effort level.
|
|
225
|
-
*
|
|
226
|
-
* xhigh is only available on Opus 4.7+.
|
|
227
|
-
*
|
|
228
|
-
* @param modelString - The model identifier string
|
|
229
|
-
* @returns true if the model supports xhigh effort
|
|
230
|
-
*/
|
|
231
|
-
function supportsXHighEffort(modelString) {
|
|
232
|
-
return isClaudeVariantVersionGTE(modelString, "opus", 4, 7);
|
|
233
|
-
}
|
|
234
|
-
/**
|
|
235
|
-
* Get the available effort levels for a given Claude model.
|
|
236
|
-
*
|
|
237
|
-
* - Opus 4.7+: low, medium, high, xhigh, max
|
|
238
|
-
* - Opus 4.5+, Opus 4.6+, Sonnet 4.6+: low, medium, high, max
|
|
239
|
-
* - Other models: empty (effort not supported)
|
|
240
|
-
*
|
|
241
|
-
* @param modelString - The model identifier string
|
|
242
|
-
* @returns Record of display label to effort level value, or null if not supported
|
|
243
|
-
*/
|
|
244
|
-
function getAvailableEffortLevels(modelString) {
|
|
245
|
-
if (!supportsEffort(modelString)) {
|
|
246
|
-
return null;
|
|
247
|
-
}
|
|
248
|
-
const levels = {
|
|
249
|
-
"Low": "low",
|
|
250
|
-
"Medium": "medium",
|
|
251
|
-
"High (default)": "high",
|
|
252
|
-
"Max": "max",
|
|
253
|
-
};
|
|
254
|
-
if (supportsXHighEffort(modelString)) {
|
|
255
|
-
// Insert xhigh between high and max
|
|
256
|
-
return {
|
|
257
|
-
"Low": "low",
|
|
258
|
-
"Medium": "medium",
|
|
259
|
-
"High (default)": "high",
|
|
260
|
-
"Extra High": "xhigh",
|
|
261
|
-
"Max": "max",
|
|
262
|
-
};
|
|
263
|
-
}
|
|
264
|
-
return levels;
|
|
265
|
-
}
|
|
266
|
-
// ============================================================================
|
|
267
|
-
// Gemini Version Parsing
|
|
268
|
-
// ============================================================================
|
|
269
|
-
/**
|
|
270
|
-
* Extract Gemini version from a model ID.
|
|
271
|
-
*
|
|
272
|
-
* Examples:
|
|
273
|
-
* - "locations/global/publishers/google/models/gemini-2.5-flash" -> "2.5"
|
|
274
|
-
* - "publishers/google/models/gemini-3-pro-image-preview" -> "3"
|
|
275
|
-
* - "gemini-3.1-flash-lite-preview" -> "3.1"
|
|
276
|
-
*
|
|
277
|
-
* @param modelId - The model identifier string
|
|
278
|
-
* @returns Version string (e.g., "2.5", "3", "3.1"), or undefined if not parseable
|
|
279
|
-
*/
|
|
280
|
-
function getGeminiModelVersion(modelId) {
|
|
281
|
-
const modelName = modelId.split('/').pop() ?? modelId;
|
|
282
|
-
const match = modelName.match(/^gemini-(\d+(?:\.\d+)?)/i);
|
|
283
|
-
return match?.[1];
|
|
284
|
-
}
|
|
285
|
-
/**
|
|
286
|
-
* Parse a version string into major.minor components.
|
|
287
|
-
*
|
|
288
|
-
* @param version - Version string (e.g., "2.5", "3", "3.1")
|
|
289
|
-
* @returns Parsed version, or undefined if not parseable
|
|
290
|
-
*/
|
|
291
|
-
function parseGeminiVersion(version) {
|
|
292
|
-
const match = version.match(/^(\d+)(?:\.(\d+))?$/);
|
|
293
|
-
if (!match) {
|
|
294
|
-
return undefined;
|
|
295
|
-
}
|
|
296
|
-
return {
|
|
297
|
-
major: Number(match[1]),
|
|
298
|
-
minor: Number(match[2] ?? '0'),
|
|
299
|
-
};
|
|
300
|
-
}
|
|
301
|
-
/**
|
|
302
|
-
* Check if a Gemini model version is greater than or equal to a minimum version.
|
|
303
|
-
*
|
|
304
|
-
* @param modelId - The model identifier string
|
|
305
|
-
* @param minVersion - Minimum version string (e.g., "2.5", "3.0")
|
|
306
|
-
* @returns true if model version >= min version
|
|
307
|
-
*/
|
|
308
|
-
function isGeminiModelVersionGte(modelId, minVersion) {
|
|
309
|
-
const modelVersion = getGeminiModelVersion(modelId);
|
|
310
|
-
if (!modelVersion) {
|
|
311
|
-
return false;
|
|
312
|
-
}
|
|
313
|
-
const current = parseGeminiVersion(modelVersion);
|
|
314
|
-
const target = parseGeminiVersion(minVersion);
|
|
315
|
-
if (!current || !target) {
|
|
316
|
-
return false;
|
|
317
|
-
}
|
|
318
|
-
if (current.major > target.major) {
|
|
319
|
-
return true;
|
|
320
|
-
}
|
|
321
|
-
if (current.major < target.major) {
|
|
322
|
-
return false;
|
|
323
|
-
}
|
|
324
|
-
return current.minor >= target.minor;
|
|
325
|
-
}
|
|
326
|
-
//# sourceMappingURL=version-parsing.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"version-parsing.js","sourceRoot":"","sources":["../../../src/options/version-parsing.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;AA8BH,gDAqBC;AAUD,gDAYC;AAkCD,kEAEC;AAcD,4DAEC;AAYD,4DAEC;AAaD,oEAEC;AAWD,oEAEC;AAcD,0EAiBC;AAsBD,wCAcC;AAUD,kDAEC;AAYD,4DAqBC;AAiBD,sDAIC;AAQD,gDAUC;AASD,0DAoBC;AAzUD;;;;;;;;;;;GAWG;AACH,SAAgB,kBAAkB,CAAC,WAAmB;IAClD,4DAA4D;IAC5D,uFAAuF;IACvF,MAAM,KAAK,GAAG,WAAW,CAAC,KAAK,CAAC,2DAA2D,CAAC,CAAC;IAC7F,IAAI,KAAK,EAAE,CAAC;QACR,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,EAAiC,CAAC;QACtE,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACrC,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACpD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;IACrC,CAAC;IAED,wDAAwD;IACxD,MAAM,aAAa,GAAG,WAAW,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAC;IACrE,IAAI,aAAa,EAAE,CAAC;QAChB,MAAM,KAAK,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