@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,62 +1,207 @@
|
|
|
1
|
-
import { ModelCapabilities, ModelModalities } from
|
|
1
|
+
import type { ModelCapabilities, ModelModalities } from '../types.js';
|
|
2
2
|
|
|
3
3
|
// Explicit exception lists keyed by the model identifier (last segment after the prefix)
|
|
4
4
|
const RECORD_FOUNDATION_EXCEPTIONS: Record<string, ModelCapabilities> = {};
|
|
5
5
|
const RECORD_PROFILE_EXCEPTIONS: Record<string, ModelCapabilities> = {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
'meta.llama3-1-70b-instruct-v1:0': {
|
|
7
|
+
input: { text: true, image: false, video: false, audio: false, embed: false },
|
|
8
|
+
output: { text: true, image: false, video: false, audio: false, embed: false },
|
|
9
|
+
tool_support: false,
|
|
10
|
+
tool_support_streaming: false,
|
|
11
|
+
},
|
|
12
|
+
'meta.llama3-1-8b-instruct-v1:0': {
|
|
13
|
+
input: { text: true, image: false, video: false, audio: false, embed: false },
|
|
14
|
+
output: { text: true, image: false, video: false, audio: false, embed: false },
|
|
15
|
+
tool_support: false,
|
|
16
|
+
tool_support_streaming: false,
|
|
17
|
+
},
|
|
8
18
|
};
|
|
9
19
|
|
|
10
20
|
// Record of Bedrock model capabilities keyed by model identifier.
|
|
11
21
|
// Only include models that differ from their family defaults
|
|
12
22
|
const RECORD_MODEL_CAPABILITIES: Record<string, ModelCapabilities> = {
|
|
13
23
|
// Models with specific exceptions that differ from family
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
24
|
+
'ai21.jamba-instruct-v1:0': {
|
|
25
|
+
input: { text: true, image: false, video: false, audio: false, embed: false },
|
|
26
|
+
output: { text: true, image: false, video: false, audio: false, embed: false },
|
|
27
|
+
tool_support: false,
|
|
28
|
+
tool_support_streaming: false,
|
|
29
|
+
},
|
|
30
|
+
'amazon.nova-canvas-v1:0': {
|
|
31
|
+
input: { text: true, image: true, video: false, audio: false, embed: false },
|
|
32
|
+
output: { image: true, text: false, video: false, audio: false, embed: false },
|
|
33
|
+
tool_support: false,
|
|
34
|
+
tool_support_streaming: false,
|
|
35
|
+
},
|
|
36
|
+
'amazon.nova-micro-v1:0': {
|
|
37
|
+
input: { text: true, image: false, video: false, audio: false, embed: false },
|
|
38
|
+
output: { text: true, image: false, video: false, audio: false, embed: false },
|
|
39
|
+
tool_support: true,
|
|
40
|
+
tool_support_streaming: true,
|
|
41
|
+
},
|
|
42
|
+
'anthropic.claude-3-5-haiku-20241022-v1:0': {
|
|
43
|
+
input: { text: true, image: false, video: false, audio: false, embed: false },
|
|
44
|
+
output: { text: true, image: false, video: false, audio: false, embed: false },
|
|
45
|
+
tool_support: true,
|
|
46
|
+
tool_support_streaming: false,
|
|
47
|
+
},
|
|
48
|
+
'meta.llama3-2-11b-instruct-v1:0': {
|
|
49
|
+
input: { text: true, image: true, video: false, audio: false, embed: false },
|
|
50
|
+
output: { text: true, image: false, video: false, audio: false, embed: false },
|
|
51
|
+
tool_support: true,
|
|
52
|
+
tool_support_streaming: false,
|
|
53
|
+
},
|
|
54
|
+
'meta.llama3-2-90b-instruct-v1:0': {
|
|
55
|
+
input: { text: true, image: true, video: false, audio: false, embed: false },
|
|
56
|
+
output: { text: true, image: false, video: false, audio: false, embed: false },
|
|
57
|
+
tool_support: true,
|
|
58
|
+
tool_support_streaming: false,
|
|
59
|
+
},
|
|
20
60
|
};
|
|
21
61
|
|
|
22
62
|
// Family capabilities (longest prefix match)
|
|
23
63
|
const RECORD_FAMILY_CAPABILITIES: Record<string, ModelCapabilities> = {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
64
|
+
'ai21.jamba': {
|
|
65
|
+
input: { text: true, image: false, video: false, audio: false, embed: false },
|
|
66
|
+
output: { text: true, image: false, video: false, audio: false, embed: false },
|
|
67
|
+
tool_support: true,
|
|
68
|
+
tool_support_streaming: true,
|
|
69
|
+
},
|
|
70
|
+
'amazon.nova': {
|
|
71
|
+
input: { text: true, image: true, video: true, audio: false, embed: false },
|
|
72
|
+
output: { text: true, image: false, video: false, audio: false, embed: false },
|
|
73
|
+
tool_support: true,
|
|
74
|
+
tool_support_streaming: true,
|
|
75
|
+
},
|
|
76
|
+
'amazon.titan': {
|
|
77
|
+
input: { text: true, image: false, video: false, audio: false, embed: false },
|
|
78
|
+
output: { text: true, image: false, video: false, audio: false, embed: false },
|
|
79
|
+
tool_support: false,
|
|
80
|
+
tool_support_streaming: false,
|
|
81
|
+
},
|
|
82
|
+
'anthropic.claude-3-5-haiku': {
|
|
83
|
+
input: { text: true, image: false, video: false, audio: false, embed: false },
|
|
84
|
+
output: { text: true, image: false, video: false, audio: false, embed: false },
|
|
85
|
+
tool_support: true,
|
|
86
|
+
tool_support_streaming: false,
|
|
87
|
+
},
|
|
88
|
+
'anthropic.claude': {
|
|
89
|
+
input: { text: true, image: true, video: false, audio: false, embed: false },
|
|
90
|
+
output: { text: true, image: false, video: false, audio: false, embed: false },
|
|
91
|
+
tool_support: true,
|
|
92
|
+
tool_support_streaming: true,
|
|
93
|
+
},
|
|
94
|
+
'cohere.command-r': {
|
|
95
|
+
input: { text: true, image: false, video: false, audio: false, embed: false },
|
|
96
|
+
output: { text: true, image: false, video: false, audio: false, embed: false },
|
|
97
|
+
tool_support: true,
|
|
98
|
+
tool_support_streaming: true,
|
|
99
|
+
},
|
|
100
|
+
'cohere.command': {
|
|
101
|
+
input: { text: true, image: false, video: false, audio: false, embed: false },
|
|
102
|
+
output: { text: true, image: false, video: false, audio: false, embed: false },
|
|
103
|
+
tool_support: false,
|
|
104
|
+
tool_support_streaming: false,
|
|
105
|
+
},
|
|
106
|
+
'deepseek.r1': {
|
|
107
|
+
input: { text: true, image: false, video: false, audio: false, embed: false },
|
|
108
|
+
output: { text: true, image: false, video: false, audio: false, embed: false },
|
|
109
|
+
tool_support: false,
|
|
110
|
+
tool_support_streaming: false,
|
|
111
|
+
},
|
|
112
|
+
'meta.llama3-1': {
|
|
113
|
+
input: { text: true, image: false, video: false, audio: false, embed: false },
|
|
114
|
+
output: { text: true, image: false, video: false, audio: false, embed: false },
|
|
115
|
+
tool_support: true,
|
|
116
|
+
tool_support_streaming: false,
|
|
117
|
+
},
|
|
118
|
+
'meta.llama3-2': {
|
|
119
|
+
input: { text: true, image: true, video: false, audio: false, embed: false },
|
|
120
|
+
output: { text: true, image: false, video: false, audio: false, embed: false },
|
|
121
|
+
tool_support: false,
|
|
122
|
+
tool_support_streaming: false,
|
|
123
|
+
},
|
|
124
|
+
'meta.llama3-3': {
|
|
125
|
+
input: { text: true, image: false, video: false, audio: false, embed: false },
|
|
126
|
+
output: { text: true, image: false, video: false, audio: false, embed: false },
|
|
127
|
+
tool_support: false,
|
|
128
|
+
tool_support_streaming: false,
|
|
129
|
+
},
|
|
130
|
+
'meta.llama3': {
|
|
131
|
+
input: { text: true, image: false, video: false, audio: false, embed: false },
|
|
132
|
+
output: { text: true, image: false, video: false, audio: false, embed: false },
|
|
133
|
+
tool_support: false,
|
|
134
|
+
tool_support_streaming: false,
|
|
135
|
+
},
|
|
136
|
+
'meta.llama4': {
|
|
137
|
+
input: { text: true, image: true, video: false, audio: false, embed: false },
|
|
138
|
+
output: { text: true, image: false, video: false, audio: false, embed: false },
|
|
139
|
+
tool_support: false,
|
|
140
|
+
tool_support_streaming: false,
|
|
141
|
+
},
|
|
142
|
+
'mistral.mistral-large': {
|
|
143
|
+
input: { text: true, image: false, video: false, audio: false, embed: false },
|
|
144
|
+
output: { text: true, image: false, video: false, audio: false, embed: false },
|
|
145
|
+
tool_support: true,
|
|
146
|
+
tool_support_streaming: false,
|
|
147
|
+
},
|
|
148
|
+
'mistral.mistral': {
|
|
149
|
+
input: { text: true, image: false, video: false, audio: false, embed: false },
|
|
150
|
+
output: { text: true, image: false, video: false, audio: false, embed: false },
|
|
151
|
+
tool_support: false,
|
|
152
|
+
tool_support_streaming: false,
|
|
153
|
+
},
|
|
154
|
+
'mistral.mixtral': {
|
|
155
|
+
input: { text: true, image: false, video: false, audio: false, embed: false },
|
|
156
|
+
output: { text: true, image: false, video: false, audio: false, embed: false },
|
|
157
|
+
tool_support: false,
|
|
158
|
+
tool_support_streaming: false,
|
|
159
|
+
},
|
|
160
|
+
'mistral.pixtral': {
|
|
161
|
+
input: { text: true, image: true, video: false, audio: false, embed: false },
|
|
162
|
+
output: { text: true, image: false, video: false, audio: false, embed: false },
|
|
163
|
+
tool_support: true,
|
|
164
|
+
tool_support_streaming: false,
|
|
165
|
+
},
|
|
166
|
+
'openai.gpt-oss': {
|
|
167
|
+
input: { text: true, image: false, video: false, audio: false, embed: false },
|
|
168
|
+
output: { text: true, image: false, video: false, audio: false, embed: false },
|
|
169
|
+
tool_support: false,
|
|
170
|
+
tool_support_streaming: false,
|
|
171
|
+
},
|
|
172
|
+
'qwen.': {
|
|
173
|
+
input: { text: true, image: false, video: false, audio: false, embed: false },
|
|
174
|
+
output: { text: true, image: false, video: false, audio: false, embed: false },
|
|
175
|
+
tool_support: false,
|
|
176
|
+
tool_support_streaming: false,
|
|
177
|
+
},
|
|
178
|
+
'twelvelabs.': {
|
|
179
|
+
input: { text: true, image: false, video: true, audio: false, embed: false },
|
|
180
|
+
output: { text: true, image: false, video: false, audio: false, embed: false },
|
|
181
|
+
tool_support: true,
|
|
182
|
+
tool_support_streaming: false,
|
|
183
|
+
},
|
|
184
|
+
'writer.palmyra': {
|
|
185
|
+
input: { text: true, image: false, video: false, audio: false, embed: false },
|
|
186
|
+
output: { text: true, image: false, video: false, audio: false, embed: false },
|
|
187
|
+
tool_support: true,
|
|
188
|
+
tool_support_streaming: false,
|
|
189
|
+
},
|
|
45
190
|
};
|
|
46
191
|
|
|
47
192
|
function extractModelLookupKey(modelName: string): string {
|
|
48
193
|
const lower = modelName.toLowerCase();
|
|
49
|
-
const lastSlashIdx = lower.lastIndexOf(
|
|
194
|
+
const lastSlashIdx = lower.lastIndexOf('/');
|
|
50
195
|
let key = lastSlashIdx === -1 ? lower : lower.slice(lastSlashIdx + 1);
|
|
51
|
-
if (lower.includes(
|
|
52
|
-
key = key.replace(/^[^.]+\./,
|
|
196
|
+
if (lower.includes('inference-profile/')) {
|
|
197
|
+
key = key.replace(/^[^.]+\./, '');
|
|
53
198
|
}
|
|
54
199
|
return key;
|
|
55
200
|
}
|
|
56
201
|
|
|
57
202
|
function findFamilyCapability(
|
|
58
203
|
lookupKey: string,
|
|
59
|
-
families: Record<string, ModelCapabilities
|
|
204
|
+
families: Record<string, ModelCapabilities>,
|
|
60
205
|
): ModelCapabilities | undefined {
|
|
61
206
|
let bestKey: string | undefined;
|
|
62
207
|
for (const key of Object.keys(families)) {
|
|
@@ -74,34 +219,34 @@ function findFamilyCapability(
|
|
|
74
219
|
*/
|
|
75
220
|
function normalizeModelName(modelName: string): string {
|
|
76
221
|
const modelLower = modelName.toLowerCase();
|
|
77
|
-
if (modelLower.includes(
|
|
78
|
-
const parts = modelLower.split(
|
|
222
|
+
if (modelLower.includes('inference-profile')) {
|
|
223
|
+
const parts = modelLower.split('/');
|
|
79
224
|
if (parts.length > 1) {
|
|
80
225
|
const providerModel = parts[parts.length - 1];
|
|
81
|
-
const modelParts = providerModel.split(
|
|
82
|
-
if (modelParts.length > 1 && modelParts[1] ===
|
|
83
|
-
return `deepseek-${modelParts.slice(2).join(
|
|
226
|
+
const modelParts = providerModel.split('.');
|
|
227
|
+
if (modelParts.length > 1 && modelParts[1] === 'deepseek') {
|
|
228
|
+
return `deepseek-${modelParts.slice(2).join('.')}`;
|
|
84
229
|
}
|
|
85
|
-
return modelParts.length > 2 ? modelParts.slice(2).join(
|
|
230
|
+
return modelParts.length > 2 ? modelParts.slice(2).join('.') : providerModel;
|
|
86
231
|
}
|
|
87
232
|
}
|
|
88
233
|
return modelLower;
|
|
89
234
|
}
|
|
90
235
|
|
|
91
236
|
// Fallback pattern lists for inferring modalities and tool support
|
|
92
|
-
const IMAGE_INPUT_MODELS = [
|
|
93
|
-
const VIDEO_INPUT_MODELS = [
|
|
94
|
-
const AUDIO_INPUT_MODELS = [
|
|
95
|
-
const TEXT_INPUT_MODELS = [
|
|
96
|
-
const IMAGE_OUTPUT_MODELS = [
|
|
97
|
-
const VIDEO_OUTPUT_MODELS = [
|
|
98
|
-
const AUDIO_OUTPUT_MODELS = [
|
|
99
|
-
const TEXT_OUTPUT_MODELS = [
|
|
100
|
-
const EMBEDDING_OUTPUT_MODELS = [
|
|
101
|
-
const TOOL_SUPPORT_MODELS = [
|
|
237
|
+
const IMAGE_INPUT_MODELS = ['image']; // fallback: if model id contains 'image', supports image input
|
|
238
|
+
const VIDEO_INPUT_MODELS = ['video'];
|
|
239
|
+
const AUDIO_INPUT_MODELS = ['audio'];
|
|
240
|
+
const TEXT_INPUT_MODELS = ['text'];
|
|
241
|
+
const IMAGE_OUTPUT_MODELS = ['image'];
|
|
242
|
+
const VIDEO_OUTPUT_MODELS = ['video'];
|
|
243
|
+
const AUDIO_OUTPUT_MODELS = ['audio'];
|
|
244
|
+
const TEXT_OUTPUT_MODELS = ['text'];
|
|
245
|
+
const EMBEDDING_OUTPUT_MODELS = ['embed'];
|
|
246
|
+
const TOOL_SUPPORT_MODELS = ['tool', 'sonnet', 'opus', 'nova', 'palmyra', 'command-r', 'mistral-large', 'pixtral'];
|
|
102
247
|
|
|
103
248
|
function modelMatches(modelName: string, patterns: string[]): boolean {
|
|
104
|
-
return patterns.some(pattern => modelName.includes(pattern));
|
|
249
|
+
return patterns.some((pattern) => modelName.includes(pattern));
|
|
105
250
|
}
|
|
106
251
|
|
|
107
252
|
/**
|
|
@@ -123,8 +268,8 @@ export function getModelCapabilitiesBedrock(model: string): ModelCapabilities {
|
|
|
123
268
|
normalized = modelLower.substring(inferenceIdx);
|
|
124
269
|
}
|
|
125
270
|
}
|
|
126
|
-
const isInferenceProfile = normalized.startsWith(
|
|
127
|
-
const isFoundationModel = normalized.startsWith(
|
|
271
|
+
const isInferenceProfile = normalized.startsWith('inference-profile/');
|
|
272
|
+
const isFoundationModel = normalized.startsWith('foundation-model/');
|
|
128
273
|
const lookupKey = extractModelLookupKey(normalized);
|
|
129
274
|
|
|
130
275
|
// 1. Check exceptions
|
|
@@ -151,15 +296,15 @@ export function getModelCapabilitiesBedrock(model: string): ModelCapabilities {
|
|
|
151
296
|
image: modelMatches(inferredName, IMAGE_INPUT_MODELS) || undefined,
|
|
152
297
|
video: modelMatches(inferredName, VIDEO_INPUT_MODELS) || undefined,
|
|
153
298
|
audio: modelMatches(inferredName, AUDIO_INPUT_MODELS) || undefined,
|
|
154
|
-
embed: false
|
|
299
|
+
embed: false,
|
|
155
300
|
};
|
|
156
301
|
const output: ModelModalities = {
|
|
157
302
|
text: modelMatches(inferredName, TEXT_OUTPUT_MODELS) || undefined,
|
|
158
303
|
image: modelMatches(inferredName, IMAGE_OUTPUT_MODELS) || undefined,
|
|
159
304
|
video: modelMatches(inferredName, VIDEO_OUTPUT_MODELS) || undefined,
|
|
160
305
|
audio: modelMatches(inferredName, AUDIO_OUTPUT_MODELS) || undefined,
|
|
161
|
-
embed: modelMatches(inferredName, EMBEDDING_OUTPUT_MODELS) || undefined
|
|
306
|
+
embed: modelMatches(inferredName, EMBEDDING_OUTPUT_MODELS) || undefined,
|
|
162
307
|
};
|
|
163
308
|
const tool_support = modelMatches(inferredName, TOOL_SUPPORT_MODELS) || undefined;
|
|
164
309
|
return { input, output, tool_support };
|
|
165
|
-
}
|
|
310
|
+
}
|
package/src/capability/openai.ts
CHANGED
|
@@ -1,52 +1,141 @@
|
|
|
1
|
-
import { ModelModalities } from
|
|
1
|
+
import type { ModelModalities } from '../types.js';
|
|
2
2
|
|
|
3
3
|
// OpenAI model capability type - tool_support_streaming defaults to tool_support for OpenAI models
|
|
4
|
-
type OpenAIModelCapability = {
|
|
4
|
+
type OpenAIModelCapability = {
|
|
5
|
+
input: ModelModalities;
|
|
6
|
+
output: ModelModalities;
|
|
7
|
+
tool_support?: boolean;
|
|
8
|
+
tool_support_streaming?: boolean;
|
|
9
|
+
};
|
|
5
10
|
|
|
6
11
|
// Record of OpenAI model capabilities keyed by model ID (lowercased)
|
|
7
12
|
const RECORD_MODEL_CAPABILITIES: Record<string, OpenAIModelCapability> = {
|
|
8
|
-
|
|
13
|
+
'chatgpt-4o-latest': {
|
|
14
|
+
input: { text: true, image: true, video: false, audio: false, embed: false },
|
|
15
|
+
output: { text: true, image: false, video: false, audio: false, embed: false },
|
|
16
|
+
tool_support: true,
|
|
17
|
+
},
|
|
9
18
|
};
|
|
10
19
|
|
|
11
20
|
// Populate RECORD_FAMILY_CAPABILITIES as a const record (lowest common denominator for each family)
|
|
12
21
|
// For OpenAI, tool_support_streaming matches tool_support since the API supports tools while streaming
|
|
13
22
|
const RECORD_FAMILY_CAPABILITIES: Record<string, OpenAIModelCapability> = {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
23
|
+
gpt: {
|
|
24
|
+
input: { text: true, image: true, video: false, audio: false, embed: false },
|
|
25
|
+
output: { text: true, image: false, video: false, audio: false, embed: false },
|
|
26
|
+
tool_support: true,
|
|
27
|
+
},
|
|
28
|
+
'gpt-3.5': {
|
|
29
|
+
input: { text: true, image: false, video: false, audio: false, embed: false },
|
|
30
|
+
output: { text: true, image: false, video: false, audio: false, embed: false },
|
|
31
|
+
tool_support: false,
|
|
32
|
+
},
|
|
33
|
+
'gpt-4': {
|
|
34
|
+
input: { text: true, image: false, video: false, audio: false, embed: false },
|
|
35
|
+
output: { text: true, image: false, video: false, audio: false, embed: false },
|
|
36
|
+
tool_support: true,
|
|
37
|
+
},
|
|
38
|
+
'gpt-4-turbo': {
|
|
39
|
+
input: { text: true, image: true, video: false, audio: false, embed: false },
|
|
40
|
+
output: { text: true, image: false, video: false, audio: false, embed: false },
|
|
41
|
+
tool_support: true,
|
|
42
|
+
},
|
|
43
|
+
'gpt-4o': {
|
|
44
|
+
input: { text: true, image: true, video: false, audio: false, embed: false },
|
|
45
|
+
output: { text: true, image: false, video: false, audio: false, embed: false },
|
|
46
|
+
tool_support: true,
|
|
47
|
+
},
|
|
48
|
+
'gpt-4.1': {
|
|
49
|
+
input: { text: true, image: true, video: false, audio: false, embed: false },
|
|
50
|
+
output: { text: true, image: false, video: false, audio: false, embed: false },
|
|
51
|
+
tool_support: true,
|
|
52
|
+
},
|
|
53
|
+
'gpt-4.5': {
|
|
54
|
+
input: { text: true, image: true, video: false, audio: false, embed: false },
|
|
55
|
+
output: { text: true, image: false, video: false, audio: false, embed: false },
|
|
56
|
+
tool_support: true,
|
|
57
|
+
},
|
|
58
|
+
'gpt-5': {
|
|
59
|
+
input: { text: true, image: true, video: false, audio: false, embed: false },
|
|
60
|
+
output: { text: true, image: false, video: false, audio: false, embed: false },
|
|
61
|
+
tool_support: true,
|
|
62
|
+
},
|
|
63
|
+
'gpt-image': {
|
|
64
|
+
input: { text: true, image: true, video: false, audio: false, embed: false },
|
|
65
|
+
output: { text: false, image: true, video: false, audio: false, embed: false },
|
|
66
|
+
tool_support: false,
|
|
67
|
+
},
|
|
68
|
+
'chatgpt-image': {
|
|
69
|
+
input: { text: true, image: true, video: false, audio: false, embed: false },
|
|
70
|
+
output: { text: false, image: true, video: false, audio: false, embed: false },
|
|
71
|
+
tool_support: false,
|
|
72
|
+
},
|
|
73
|
+
'dall-e': {
|
|
74
|
+
input: { text: true, image: false, video: false, audio: false, embed: false },
|
|
75
|
+
output: { text: false, image: true, video: false, audio: false, embed: false },
|
|
76
|
+
tool_support: false,
|
|
77
|
+
},
|
|
78
|
+
'gpt-oss': {
|
|
79
|
+
input: { text: true, image: false, video: false, audio: false, embed: false },
|
|
80
|
+
output: { text: true, image: false, video: false, audio: false, embed: false },
|
|
81
|
+
tool_support: false,
|
|
82
|
+
},
|
|
83
|
+
o: {
|
|
84
|
+
input: { text: true, image: true, video: false, audio: false, embed: false },
|
|
85
|
+
output: { text: true, image: false, video: false, audio: false, embed: false },
|
|
86
|
+
tool_support: true,
|
|
87
|
+
},
|
|
88
|
+
'o1-mini': {
|
|
89
|
+
input: { text: true, image: true, video: false, audio: false, embed: false },
|
|
90
|
+
output: { text: true, image: false, video: false, audio: false, embed: false },
|
|
91
|
+
tool_support: false,
|
|
92
|
+
},
|
|
93
|
+
'o1-preview': {
|
|
94
|
+
input: { text: true, image: false, video: false, audio: false, embed: false },
|
|
95
|
+
output: { text: true, image: false, video: false, audio: false, embed: false },
|
|
96
|
+
tool_support: false,
|
|
97
|
+
},
|
|
98
|
+
'omni-moderation': {
|
|
99
|
+
input: { text: true, image: true, video: false, audio: false, embed: false },
|
|
100
|
+
output: { text: true, image: false, video: false, audio: false, embed: false },
|
|
101
|
+
tool_support: false,
|
|
102
|
+
},
|
|
103
|
+
sora: {
|
|
104
|
+
input: { text: true, image: true, video: true, audio: false, embed: false },
|
|
105
|
+
output: { text: false, image: false, video: true, audio: true, embed: false },
|
|
106
|
+
tool_support: false,
|
|
107
|
+
},
|
|
108
|
+
'text-embedding': {
|
|
109
|
+
input: { text: true, image: false, video: false, audio: false, embed: false },
|
|
110
|
+
output: { text: false, image: false, video: false, audio: false, embed: true },
|
|
111
|
+
tool_support: false,
|
|
112
|
+
},
|
|
113
|
+
'text-moderation': {
|
|
114
|
+
input: { text: true, image: false, video: false, audio: false, embed: false },
|
|
115
|
+
output: { text: true, image: false, video: false, audio: false, embed: false },
|
|
116
|
+
tool_support: false,
|
|
117
|
+
},
|
|
118
|
+
whisper: {
|
|
119
|
+
input: { text: false, image: false, video: false, audio: true, embed: false },
|
|
120
|
+
output: { text: true, image: false, video: false, audio: false, embed: false },
|
|
121
|
+
tool_support: false,
|
|
122
|
+
},
|
|
34
123
|
};
|
|
35
124
|
|
|
36
125
|
// Fallback pattern lists for inferring modalities and tool support
|
|
37
|
-
const IMAGE_INPUT_MODELS = [
|
|
38
|
-
const VIDEO_INPUT_MODELS = [
|
|
39
|
-
const AUDIO_INPUT_MODELS = [
|
|
40
|
-
const TEXT_INPUT_MODELS = [
|
|
41
|
-
const IMAGE_OUTPUT_MODELS = [
|
|
42
|
-
const VIDEO_OUTPUT_MODELS = [
|
|
43
|
-
const AUDIO_OUTPUT_MODELS = [
|
|
44
|
-
const TEXT_OUTPUT_MODELS = [
|
|
45
|
-
const EMBEDDING_OUTPUT_MODELS = [
|
|
46
|
-
const TOOL_SUPPORT_MODELS = [
|
|
126
|
+
const IMAGE_INPUT_MODELS = ['image'];
|
|
127
|
+
const VIDEO_INPUT_MODELS = ['video'];
|
|
128
|
+
const AUDIO_INPUT_MODELS = ['audio'];
|
|
129
|
+
const TEXT_INPUT_MODELS = ['text'];
|
|
130
|
+
const IMAGE_OUTPUT_MODELS = ['image'];
|
|
131
|
+
const VIDEO_OUTPUT_MODELS = ['video'];
|
|
132
|
+
const AUDIO_OUTPUT_MODELS = ['audio'];
|
|
133
|
+
const TEXT_OUTPUT_MODELS = ['text'];
|
|
134
|
+
const EMBEDDING_OUTPUT_MODELS = ['embed'];
|
|
135
|
+
const TOOL_SUPPORT_MODELS = ['tool', 'gpt', 'gpt-5', 'o1', 'o3', 'o4'];
|
|
47
136
|
|
|
48
137
|
function modelMatches(modelName: string, patterns: string[]): boolean {
|
|
49
|
-
return patterns.some(pattern => modelName.includes(pattern));
|
|
138
|
+
return patterns.some((pattern) => modelName.includes(pattern));
|
|
50
139
|
}
|
|
51
140
|
|
|
52
141
|
function normalizeOpenAIModelName(modelName: string): string {
|
|
@@ -58,17 +147,22 @@ function normalizeOpenAIModelName(modelName: string): string {
|
|
|
58
147
|
* Checks RECORD_MODEL_CAPABILITIES first, then falls back to pattern-based inference.
|
|
59
148
|
* For OpenAI models, tool_support_streaming defaults to tool_support since the API supports tools while streaming.
|
|
60
149
|
*/
|
|
61
|
-
export function getModelCapabilitiesOpenAI(model: string): {
|
|
150
|
+
export function getModelCapabilitiesOpenAI(model: string): {
|
|
151
|
+
input: ModelModalities;
|
|
152
|
+
output: ModelModalities;
|
|
153
|
+
tool_support?: boolean;
|
|
154
|
+
tool_support_streaming?: boolean;
|
|
155
|
+
} {
|
|
62
156
|
const normalized = normalizeOpenAIModelName(model);
|
|
63
157
|
const record = RECORD_MODEL_CAPABILITIES[normalized];
|
|
64
158
|
if (record) {
|
|
65
159
|
// Default tool_support_streaming to tool_support for OpenAI models
|
|
66
160
|
return {
|
|
67
161
|
...record,
|
|
68
|
-
tool_support_streaming: record.tool_support_streaming ?? record.tool_support
|
|
162
|
+
tool_support_streaming: record.tool_support_streaming ?? record.tool_support,
|
|
69
163
|
};
|
|
70
164
|
}
|
|
71
|
-
let bestFamilyKey
|
|
165
|
+
let bestFamilyKey: string | undefined;
|
|
72
166
|
let bestFamilyLength = 0;
|
|
73
167
|
for (const key of Object.keys(RECORD_FAMILY_CAPABILITIES)) {
|
|
74
168
|
if (normalized.startsWith(key) && key.length > bestFamilyLength) {
|
|
@@ -81,7 +175,7 @@ export function getModelCapabilitiesOpenAI(model: string): { input: ModelModalit
|
|
|
81
175
|
// Default tool_support_streaming to tool_support for OpenAI models
|
|
82
176
|
return {
|
|
83
177
|
...family,
|
|
84
|
-
tool_support_streaming: family.tool_support_streaming ?? family.tool_support
|
|
178
|
+
tool_support_streaming: family.tool_support_streaming ?? family.tool_support,
|
|
85
179
|
};
|
|
86
180
|
}
|
|
87
181
|
const input: ModelModalities = {
|
|
@@ -89,16 +183,16 @@ export function getModelCapabilitiesOpenAI(model: string): { input: ModelModalit
|
|
|
89
183
|
image: modelMatches(normalized, IMAGE_INPUT_MODELS) || undefined,
|
|
90
184
|
video: modelMatches(normalized, VIDEO_INPUT_MODELS) || undefined,
|
|
91
185
|
audio: modelMatches(normalized, AUDIO_INPUT_MODELS) || undefined,
|
|
92
|
-
embed: false
|
|
186
|
+
embed: false,
|
|
93
187
|
};
|
|
94
188
|
const output: ModelModalities = {
|
|
95
189
|
text: modelMatches(normalized, TEXT_OUTPUT_MODELS) || undefined,
|
|
96
190
|
image: modelMatches(normalized, IMAGE_OUTPUT_MODELS) || undefined,
|
|
97
191
|
video: modelMatches(normalized, VIDEO_OUTPUT_MODELS) || undefined,
|
|
98
192
|
audio: modelMatches(normalized, AUDIO_OUTPUT_MODELS) || undefined,
|
|
99
|
-
embed: modelMatches(normalized, EMBEDDING_OUTPUT_MODELS) || undefined
|
|
193
|
+
embed: modelMatches(normalized, EMBEDDING_OUTPUT_MODELS) || undefined,
|
|
100
194
|
};
|
|
101
195
|
const tool_support = modelMatches(normalized, TOOL_SUPPORT_MODELS) || undefined;
|
|
102
196
|
// Default tool_support_streaming to tool_support for OpenAI models
|
|
103
197
|
return { input, output, tool_support, tool_support_streaming: tool_support };
|
|
104
|
-
}
|
|
198
|
+
}
|