@llumiverse/common 1.3.0 → 1.4.0-dev.20260629.090753Z
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,46 +1,112 @@
|
|
|
1
|
-
import { ModelModalities } from
|
|
1
|
+
import type { ModelModalities } from '../types.js';
|
|
2
2
|
|
|
3
3
|
// Record of Vertex AI model capabilities keyed by model ID (last path segment, lowercased)
|
|
4
|
-
const RECORD_MODEL_CAPABILITIES: Record<
|
|
5
|
-
|
|
4
|
+
const RECORD_MODEL_CAPABILITIES: Record<
|
|
5
|
+
string,
|
|
6
|
+
{ input: ModelModalities; output: ModelModalities; tool_support?: boolean }
|
|
7
|
+
> = {
|
|
8
|
+
'gemini-2.0-flash-lite-001': {
|
|
9
|
+
input: { text: true, image: true, video: true, audio: true, embed: false },
|
|
10
|
+
output: { text: true, image: false, video: false, audio: false, embed: false },
|
|
11
|
+
tool_support: false,
|
|
12
|
+
},
|
|
6
13
|
};
|
|
7
14
|
|
|
8
15
|
// Populate RECORD_FAMILY_CAPABILITIES as a const record (lowest common denominator for each family)
|
|
9
|
-
const RECORD_FAMILY_CAPABILITIES: Record<
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
16
|
+
const RECORD_FAMILY_CAPABILITIES: Record<
|
|
17
|
+
string,
|
|
18
|
+
{ input: ModelModalities; output: ModelModalities; tool_support?: boolean }
|
|
19
|
+
> = {
|
|
20
|
+
gemini: {
|
|
21
|
+
input: { text: true, image: true, video: true, audio: true, embed: false },
|
|
22
|
+
output: { text: true, image: false, video: false, audio: false, embed: false },
|
|
23
|
+
tool_support: true,
|
|
24
|
+
},
|
|
25
|
+
'gemini-2.5-flash-image': {
|
|
26
|
+
input: { text: true, image: true, video: false, audio: false, embed: false },
|
|
27
|
+
output: { text: true, image: true, video: false, audio: false, embed: false },
|
|
28
|
+
tool_support: false,
|
|
29
|
+
},
|
|
30
|
+
'gemini-3.0-pro-image': {
|
|
31
|
+
input: { text: true, image: true, video: false, audio: false, embed: false },
|
|
32
|
+
output: { text: true, image: true, video: false, audio: false, embed: false },
|
|
33
|
+
tool_support: false,
|
|
34
|
+
},
|
|
35
|
+
'gemini-3.0-flash-image': {
|
|
36
|
+
input: { text: true, image: true, video: false, audio: false, embed: false },
|
|
37
|
+
output: { text: true, image: true, video: false, audio: false, embed: false },
|
|
38
|
+
tool_support: false,
|
|
39
|
+
},
|
|
40
|
+
imagen: {
|
|
41
|
+
input: { text: true, image: true, video: false, audio: false, embed: false },
|
|
42
|
+
output: { text: false, image: true, video: false, audio: false, embed: false },
|
|
43
|
+
tool_support: false,
|
|
44
|
+
},
|
|
45
|
+
'imagen-3.0': {
|
|
46
|
+
input: { text: true, image: false, video: false, audio: false, embed: false },
|
|
47
|
+
output: { text: false, image: true, video: false, audio: false, embed: false },
|
|
48
|
+
tool_support: false,
|
|
49
|
+
},
|
|
50
|
+
'imagen-3.0-capability': {
|
|
51
|
+
input: { text: true, image: true, video: false, audio: false, embed: false },
|
|
52
|
+
output: { text: false, image: true, video: false, audio: false, embed: false },
|
|
53
|
+
tool_support: false,
|
|
54
|
+
},
|
|
55
|
+
'imagen-4.0': {
|
|
56
|
+
input: { text: true, image: false, video: false, audio: false, embed: false },
|
|
57
|
+
output: { text: false, image: true, video: false, audio: false, embed: false },
|
|
58
|
+
tool_support: false,
|
|
59
|
+
},
|
|
60
|
+
'imagen-4.0-capability': {
|
|
61
|
+
input: { text: true, image: true, video: false, audio: false, embed: false },
|
|
62
|
+
output: { text: false, image: true, video: false, audio: false, embed: false },
|
|
63
|
+
tool_support: false,
|
|
64
|
+
},
|
|
65
|
+
claude: {
|
|
66
|
+
input: { text: true, image: true, video: false, audio: false, embed: false },
|
|
67
|
+
output: { text: true, image: false, video: false, audio: false, embed: false },
|
|
68
|
+
tool_support: true,
|
|
69
|
+
},
|
|
70
|
+
llama: {
|
|
71
|
+
input: { text: true, image: false, video: false, audio: false, embed: false },
|
|
72
|
+
output: { text: true, image: false, video: false, audio: false, embed: false },
|
|
73
|
+
tool_support: true,
|
|
74
|
+
},
|
|
75
|
+
'llama-2': {
|
|
76
|
+
input: { text: true, image: false, video: false, audio: false, embed: false },
|
|
77
|
+
output: { text: true, image: false, video: false, audio: false, embed: false },
|
|
78
|
+
tool_support: false,
|
|
79
|
+
},
|
|
80
|
+
'llama-3.2': {
|
|
81
|
+
input: { text: true, image: true, video: false, audio: false, embed: false },
|
|
82
|
+
output: { text: true, image: false, video: false, audio: false, embed: false },
|
|
83
|
+
tool_support: true,
|
|
84
|
+
},
|
|
85
|
+
'llama-4': {
|
|
86
|
+
input: { text: true, image: true, video: false, audio: false, embed: false },
|
|
87
|
+
output: { text: true, image: false, video: false, audio: false, embed: false },
|
|
88
|
+
tool_support: true,
|
|
89
|
+
},
|
|
24
90
|
};
|
|
25
91
|
|
|
26
92
|
// Fallback pattern lists for inferring modalities and tool support
|
|
27
|
-
const IMAGE_INPUT_MODELS = [
|
|
28
|
-
const VIDEO_INPUT_MODELS = [
|
|
29
|
-
const AUDIO_INPUT_MODELS = [
|
|
30
|
-
const TEXT_INPUT_MODELS = [
|
|
31
|
-
const IMAGE_OUTPUT_MODELS = [
|
|
32
|
-
const VIDEO_OUTPUT_MODELS = [
|
|
33
|
-
const AUDIO_OUTPUT_MODELS = [
|
|
34
|
-
const TEXT_OUTPUT_MODELS = [
|
|
35
|
-
const EMBEDDING_OUTPUT_MODELS = [
|
|
36
|
-
const TOOL_SUPPORT_MODELS = [
|
|
93
|
+
const IMAGE_INPUT_MODELS = ['image'];
|
|
94
|
+
const VIDEO_INPUT_MODELS = ['video'];
|
|
95
|
+
const AUDIO_INPUT_MODELS = ['audio'];
|
|
96
|
+
const TEXT_INPUT_MODELS = ['text'];
|
|
97
|
+
const IMAGE_OUTPUT_MODELS = ['image'];
|
|
98
|
+
const VIDEO_OUTPUT_MODELS = ['video'];
|
|
99
|
+
const AUDIO_OUTPUT_MODELS = ['audio'];
|
|
100
|
+
const TEXT_OUTPUT_MODELS = ['text'];
|
|
101
|
+
const EMBEDDING_OUTPUT_MODELS = ['embed'];
|
|
102
|
+
const TOOL_SUPPORT_MODELS = ['tool', 'sonnet', 'opus', 'gemini', 'claude'];
|
|
37
103
|
|
|
38
104
|
function modelMatches(modelName: string, patterns: string[]): boolean {
|
|
39
|
-
return patterns.some(pattern => modelName.includes(pattern));
|
|
105
|
+
return patterns.some((pattern) => modelName.includes(pattern));
|
|
40
106
|
}
|
|
41
107
|
|
|
42
108
|
function normalizeVertexAIModelName(modelName: string): string {
|
|
43
|
-
const segments = modelName.toLowerCase().split(
|
|
109
|
+
const segments = modelName.toLowerCase().split('/');
|
|
44
110
|
return segments[segments.length - 1];
|
|
45
111
|
}
|
|
46
112
|
|
|
@@ -48,11 +114,15 @@ function normalizeVertexAIModelName(modelName: string): string {
|
|
|
48
114
|
* Get the full ModelCapabilities for a Vertex AI model.
|
|
49
115
|
* Checks RECORD_MODEL_CAPABILITIES first, then falls back to pattern-based inference.
|
|
50
116
|
*/
|
|
51
|
-
export function getModelCapabilitiesVertexAI(model: string): {
|
|
117
|
+
export function getModelCapabilitiesVertexAI(model: string): {
|
|
118
|
+
input: ModelModalities;
|
|
119
|
+
output: ModelModalities;
|
|
120
|
+
tool_support?: boolean;
|
|
121
|
+
} {
|
|
52
122
|
const normalized = normalizeVertexAIModelName(model);
|
|
53
123
|
const record = RECORD_MODEL_CAPABILITIES[normalized];
|
|
54
124
|
if (record) return record;
|
|
55
|
-
let bestFamilyKey
|
|
125
|
+
let bestFamilyKey: string | undefined;
|
|
56
126
|
let bestFamilyLength = 0;
|
|
57
127
|
for (const key of Object.keys(RECORD_FAMILY_CAPABILITIES)) {
|
|
58
128
|
if (normalized.startsWith(key) && key.length > bestFamilyLength) {
|
|
@@ -68,15 +138,15 @@ export function getModelCapabilitiesVertexAI(model: string): { input: ModelModal
|
|
|
68
138
|
image: modelMatches(normalized, IMAGE_INPUT_MODELS) || undefined,
|
|
69
139
|
video: modelMatches(normalized, VIDEO_INPUT_MODELS) || undefined,
|
|
70
140
|
audio: modelMatches(normalized, AUDIO_INPUT_MODELS) || undefined,
|
|
71
|
-
embed: false
|
|
141
|
+
embed: false,
|
|
72
142
|
};
|
|
73
143
|
const output: ModelModalities = {
|
|
74
144
|
text: modelMatches(normalized, TEXT_OUTPUT_MODELS) || undefined,
|
|
75
145
|
image: modelMatches(normalized, IMAGE_OUTPUT_MODELS) || undefined,
|
|
76
146
|
video: modelMatches(normalized, VIDEO_OUTPUT_MODELS) || undefined,
|
|
77
147
|
audio: modelMatches(normalized, AUDIO_OUTPUT_MODELS) || undefined,
|
|
78
|
-
embed: modelMatches(normalized, EMBEDDING_OUTPUT_MODELS) || undefined
|
|
148
|
+
embed: modelMatches(normalized, EMBEDDING_OUTPUT_MODELS) || undefined,
|
|
79
149
|
};
|
|
80
150
|
const tool_support = modelMatches(normalized, TOOL_SUPPORT_MODELS) || undefined;
|
|
81
151
|
return { input, output, tool_support };
|
|
82
|
-
}
|
|
152
|
+
}
|
package/src/capability.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { getModelCapabilitiesAnthropic } from
|
|
2
|
-
import { getModelCapabilitiesAzureFoundry } from
|
|
3
|
-
import { getModelCapabilitiesBedrock } from
|
|
4
|
-
import { getModelCapabilitiesOpenAI } from
|
|
5
|
-
import { getModelCapabilitiesVertexAI } from
|
|
6
|
-
import { type ModelCapabilities, type ModelModalities, Providers } from
|
|
1
|
+
import { getModelCapabilitiesAnthropic } from './capability/anthropic.js';
|
|
2
|
+
import { getModelCapabilitiesAzureFoundry } from './capability/azure_foundry.js';
|
|
3
|
+
import { getModelCapabilitiesBedrock } from './capability/bedrock.js';
|
|
4
|
+
import { getModelCapabilitiesOpenAI } from './capability/openai.js';
|
|
5
|
+
import { getModelCapabilitiesVertexAI } from './capability/vertexai.js';
|
|
6
|
+
import { type ModelCapabilities, type ModelModalities, Providers } from './types.js';
|
|
7
7
|
|
|
8
8
|
export function getModelCapabilities(model: string, provider?: string | Providers): ModelCapabilities {
|
|
9
9
|
//Check for locations/<location>/ prefix and remove it
|
|
10
|
-
if (model.startsWith(
|
|
11
|
-
const parts = model.split(
|
|
10
|
+
if (model.startsWith('locations/')) {
|
|
11
|
+
const parts = model.split('/');
|
|
12
12
|
if (parts.length >= 3) {
|
|
13
|
-
model = parts.slice(2).join(
|
|
13
|
+
model = parts.slice(2).join('/');
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
const capabilities = _getModelCapabilities(model, provider);
|
|
@@ -47,28 +47,28 @@ function _getModelCapabilities(model: string, provider?: string | Providers): Mo
|
|
|
47
47
|
case Providers.xai:
|
|
48
48
|
// xAI (Grok) models support tool use and are text-based
|
|
49
49
|
return {
|
|
50
|
-
input: { text: true, image: model.includes(
|
|
50
|
+
input: { text: true, image: model.includes('vision') },
|
|
51
51
|
output: { text: true },
|
|
52
52
|
tool_support: true,
|
|
53
53
|
tool_support_streaming: false, // Conservative - may work but not tested
|
|
54
54
|
};
|
|
55
55
|
default:
|
|
56
56
|
// Guess the provider based on the model name
|
|
57
|
-
if (model.startsWith(
|
|
57
|
+
if (model.startsWith('gpt')) {
|
|
58
58
|
return getModelCapabilitiesOpenAI(model);
|
|
59
|
-
} else if (model.startsWith(
|
|
59
|
+
} else if (model.startsWith('claude')) {
|
|
60
60
|
return getModelCapabilitiesAnthropic(model);
|
|
61
|
-
} else if (model.startsWith(
|
|
61
|
+
} else if (model.startsWith('grok')) {
|
|
62
62
|
// xAI Grok models
|
|
63
63
|
return {
|
|
64
|
-
input: { text: true, image: model.includes(
|
|
64
|
+
input: { text: true, image: model.includes('vision') },
|
|
65
65
|
output: { text: true },
|
|
66
66
|
tool_support: true,
|
|
67
67
|
tool_support_streaming: false,
|
|
68
68
|
};
|
|
69
|
-
} else if (model.startsWith(
|
|
69
|
+
} else if (model.startsWith('publishers/')) {
|
|
70
70
|
return getModelCapabilitiesVertexAI(model);
|
|
71
|
-
} else if (model.startsWith(
|
|
71
|
+
} else if (model.startsWith('arn:aws')) {
|
|
72
72
|
return getModelCapabilitiesBedrock(model);
|
|
73
73
|
}
|
|
74
74
|
// Fallback to a generic model with no capabilities
|
|
@@ -90,7 +90,7 @@ function getModelCapabilitiesOpenAICompatible(model: string): ModelCapabilities
|
|
|
90
90
|
return caps;
|
|
91
91
|
}
|
|
92
92
|
const normalized = model.toLowerCase();
|
|
93
|
-
const isNonToolModel = NO_TOOL_SUPPORT_PATTERNS.some(p => normalized.includes(p));
|
|
93
|
+
const isNonToolModel = NO_TOOL_SUPPORT_PATTERNS.some((p) => normalized.includes(p));
|
|
94
94
|
return {
|
|
95
95
|
input: { text: true },
|
|
96
96
|
output: { text: true },
|
|
@@ -108,4 +108,4 @@ export function modelModalitiesToArray(modalities: ModelModalities): string[] {
|
|
|
108
108
|
return Object.entries(modalities)
|
|
109
109
|
.filter(([_, isSupported]) => isSupported)
|
|
110
110
|
.map(([modality]) => modality);
|
|
111
|
-
}
|
|
111
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
8
|
-
export * from
|
|
9
|
-
export * from
|
|
10
|
-
export * from
|
|
11
|
-
export * from
|
|
12
|
-
export * from
|
|
1
|
+
export * from './capability.js';
|
|
2
|
+
export * from './options/anthropic.js';
|
|
3
|
+
export * from './options/bedrock.js';
|
|
4
|
+
export * from './options/context-windows.js';
|
|
5
|
+
export * from './options/embedding.js';
|
|
6
|
+
export * from './options/fallback.js';
|
|
7
|
+
export * from './options/groq.js';
|
|
8
|
+
export * from './options/openai.js';
|
|
9
|
+
export * from './options/shared-parsing.js';
|
|
10
|
+
export * from './options/version-parsing.js';
|
|
11
|
+
export * from './options/vertexai.js';
|
|
12
|
+
export * from './options.js';
|
|
13
|
+
export * from './types.js';
|
package/src/options/anthropic.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type ModelOptions, type ModelOptionsInfo, OptionType, SharedOptions } from
|
|
2
|
-
import { textOptionsFallback } from
|
|
1
|
+
import { type ModelOptions, type ModelOptionsInfo, OptionType, SharedOptions } from '../types.js';
|
|
2
|
+
import { textOptionsFallback } from './fallback.js';
|
|
3
3
|
import {
|
|
4
4
|
buildClaudeCacheOptions,
|
|
5
5
|
buildClaudeCacheTtlOptions,
|
|
@@ -7,11 +7,11 @@ import {
|
|
|
7
7
|
buildClaudeIncludeThoughtsOption,
|
|
8
8
|
buildClaudeThinkingBudgetOption,
|
|
9
9
|
getClaudeMaxTokensLimit,
|
|
10
|
-
} from
|
|
11
|
-
import { hasSamplingParameterRestriction } from
|
|
10
|
+
} from './shared-parsing.js';
|
|
11
|
+
import { hasSamplingParameterRestriction } from './version-parsing.js';
|
|
12
12
|
|
|
13
13
|
export interface AnthropicClaudeOptions {
|
|
14
|
-
_option_id:
|
|
14
|
+
_option_id: 'anthropic-claude';
|
|
15
15
|
max_tokens?: number;
|
|
16
16
|
temperature?: number;
|
|
17
17
|
top_p?: number;
|
|
@@ -26,24 +26,27 @@ export interface AnthropicClaudeOptions {
|
|
|
26
26
|
|
|
27
27
|
export function getAnthropicOptions(model: string, option?: ModelOptions): ModelOptionsInfo {
|
|
28
28
|
const max_tokens_limit = getClaudeMaxTokensLimit(model);
|
|
29
|
-
const excludeOptions = [
|
|
29
|
+
const excludeOptions = ['max_tokens', 'presence_penalty', 'frequency_penalty'];
|
|
30
30
|
let commonOptions = textOptionsFallback.options.filter((o) => !excludeOptions.includes(o.name));
|
|
31
31
|
|
|
32
32
|
const hasSamplingRestriction = hasSamplingParameterRestriction(model);
|
|
33
33
|
if (hasSamplingRestriction) {
|
|
34
|
-
commonOptions = commonOptions.filter(
|
|
35
|
-
o.name !== SharedOptions.temperature &&
|
|
36
|
-
o.name !== SharedOptions.top_p &&
|
|
37
|
-
o.name !== "top_k"
|
|
34
|
+
commonOptions = commonOptions.filter(
|
|
35
|
+
(o) => o.name !== SharedOptions.temperature && o.name !== SharedOptions.top_p && o.name !== 'top_k',
|
|
38
36
|
);
|
|
39
37
|
}
|
|
40
38
|
|
|
41
39
|
return {
|
|
42
|
-
_option_id:
|
|
40
|
+
_option_id: 'anthropic-claude',
|
|
43
41
|
options: [
|
|
44
42
|
{
|
|
45
|
-
name: SharedOptions.max_tokens,
|
|
46
|
-
|
|
43
|
+
name: SharedOptions.max_tokens,
|
|
44
|
+
type: OptionType.numeric,
|
|
45
|
+
min: 1,
|
|
46
|
+
max: max_tokens_limit,
|
|
47
|
+
integer: true,
|
|
48
|
+
step: 200,
|
|
49
|
+
description: 'The maximum number of tokens to generate',
|
|
47
50
|
},
|
|
48
51
|
...commonOptions,
|
|
49
52
|
...buildClaudeEffortOptions(model),
|