@contractspec/lib.ai-providers 1.57.0 → 1.58.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/dist/browser/factory.js +504 -0
- package/dist/browser/index.js +641 -0
- package/dist/browser/legacy.js +572 -0
- package/dist/browser/models.js +248 -0
- package/dist/browser/types.js +0 -0
- package/dist/browser/validation.js +563 -0
- package/dist/factory.d.ts +4 -8
- package/dist/factory.d.ts.map +1 -1
- package/dist/factory.js +494 -215
- package/dist/index.d.ts +11 -6
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +641 -5
- package/dist/legacy.d.ts +19 -11
- package/dist/legacy.d.ts.map +1 -1
- package/dist/legacy.js +566 -66
- package/dist/models.d.ts +10 -11
- package/dist/models.d.ts.map +1 -1
- package/dist/models.js +239 -290
- package/dist/node/factory.js +504 -0
- package/dist/node/index.js +641 -0
- package/dist/node/legacy.js +572 -0
- package/dist/node/models.js +248 -0
- package/dist/node/types.js +0 -0
- package/dist/node/validation.js +563 -0
- package/dist/types.d.ts +76 -77
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -0
- package/dist/validation.d.ts +13 -14
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +556 -53
- package/package.json +59 -24
- package/dist/factory.js.map +0 -1
- package/dist/legacy.js.map +0 -1
- package/dist/models.js.map +0 -1
- package/dist/validation.js.map +0 -1
package/dist/models.js
CHANGED
|
@@ -1,300 +1,249 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
mistral: "mistral-large-latest",
|
|
10
|
-
gemini: "gemini-2.0-flash"
|
|
1
|
+
// @bun
|
|
2
|
+
// src/models.ts
|
|
3
|
+
var DEFAULT_MODELS = {
|
|
4
|
+
ollama: "llama3.2",
|
|
5
|
+
openai: "gpt-4o",
|
|
6
|
+
anthropic: "claude-sonnet-4-20250514",
|
|
7
|
+
mistral: "mistral-large-latest",
|
|
8
|
+
gemini: "gemini-2.0-flash"
|
|
11
9
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
vision: true,
|
|
231
|
-
tools: true,
|
|
232
|
-
reasoning: false,
|
|
233
|
-
streaming: true
|
|
234
|
-
},
|
|
235
|
-
costPerMillion: {
|
|
236
|
-
input: .075,
|
|
237
|
-
output: .3
|
|
238
|
-
}
|
|
239
|
-
},
|
|
240
|
-
{
|
|
241
|
-
id: "gemini-2.5-pro-preview-06-05",
|
|
242
|
-
name: "Gemini 2.5 Pro",
|
|
243
|
-
provider: "gemini",
|
|
244
|
-
contextWindow: 1e6,
|
|
245
|
-
capabilities: {
|
|
246
|
-
vision: true,
|
|
247
|
-
tools: true,
|
|
248
|
-
reasoning: true,
|
|
249
|
-
streaming: true
|
|
250
|
-
},
|
|
251
|
-
costPerMillion: {
|
|
252
|
-
input: 1.25,
|
|
253
|
-
output: 10
|
|
254
|
-
}
|
|
255
|
-
},
|
|
256
|
-
{
|
|
257
|
-
id: "gemini-2.5-flash-preview-05-20",
|
|
258
|
-
name: "Gemini 2.5 Flash",
|
|
259
|
-
provider: "gemini",
|
|
260
|
-
contextWindow: 1e6,
|
|
261
|
-
capabilities: {
|
|
262
|
-
vision: true,
|
|
263
|
-
tools: true,
|
|
264
|
-
reasoning: true,
|
|
265
|
-
streaming: true
|
|
266
|
-
},
|
|
267
|
-
costPerMillion: {
|
|
268
|
-
input: .15,
|
|
269
|
-
output: .6
|
|
270
|
-
}
|
|
271
|
-
}
|
|
10
|
+
var MODELS = [
|
|
11
|
+
{
|
|
12
|
+
id: "llama3.2",
|
|
13
|
+
name: "Llama 3.2",
|
|
14
|
+
provider: "ollama",
|
|
15
|
+
contextWindow: 128000,
|
|
16
|
+
capabilities: {
|
|
17
|
+
vision: false,
|
|
18
|
+
tools: true,
|
|
19
|
+
reasoning: false,
|
|
20
|
+
streaming: true
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
id: "codellama",
|
|
25
|
+
name: "Code Llama",
|
|
26
|
+
provider: "ollama",
|
|
27
|
+
contextWindow: 16000,
|
|
28
|
+
capabilities: {
|
|
29
|
+
vision: false,
|
|
30
|
+
tools: false,
|
|
31
|
+
reasoning: false,
|
|
32
|
+
streaming: true
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
id: "deepseek-coder",
|
|
37
|
+
name: "DeepSeek Coder",
|
|
38
|
+
provider: "ollama",
|
|
39
|
+
contextWindow: 16000,
|
|
40
|
+
capabilities: {
|
|
41
|
+
vision: false,
|
|
42
|
+
tools: false,
|
|
43
|
+
reasoning: false,
|
|
44
|
+
streaming: true
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
id: "mistral",
|
|
49
|
+
name: "Mistral 7B",
|
|
50
|
+
provider: "ollama",
|
|
51
|
+
contextWindow: 32000,
|
|
52
|
+
capabilities: {
|
|
53
|
+
vision: false,
|
|
54
|
+
tools: false,
|
|
55
|
+
reasoning: false,
|
|
56
|
+
streaming: true
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
id: "gpt-4o",
|
|
61
|
+
name: "GPT-4o",
|
|
62
|
+
provider: "openai",
|
|
63
|
+
contextWindow: 128000,
|
|
64
|
+
capabilities: {
|
|
65
|
+
vision: true,
|
|
66
|
+
tools: true,
|
|
67
|
+
reasoning: false,
|
|
68
|
+
streaming: true
|
|
69
|
+
},
|
|
70
|
+
costPerMillion: { input: 2.5, output: 10 }
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
id: "gpt-4o-mini",
|
|
74
|
+
name: "GPT-4o Mini",
|
|
75
|
+
provider: "openai",
|
|
76
|
+
contextWindow: 128000,
|
|
77
|
+
capabilities: {
|
|
78
|
+
vision: true,
|
|
79
|
+
tools: true,
|
|
80
|
+
reasoning: false,
|
|
81
|
+
streaming: true
|
|
82
|
+
},
|
|
83
|
+
costPerMillion: { input: 0.15, output: 0.6 }
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
id: "o1",
|
|
87
|
+
name: "o1",
|
|
88
|
+
provider: "openai",
|
|
89
|
+
contextWindow: 200000,
|
|
90
|
+
capabilities: {
|
|
91
|
+
vision: true,
|
|
92
|
+
tools: true,
|
|
93
|
+
reasoning: true,
|
|
94
|
+
streaming: true
|
|
95
|
+
},
|
|
96
|
+
costPerMillion: { input: 15, output: 60 }
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
id: "o1-mini",
|
|
100
|
+
name: "o1 Mini",
|
|
101
|
+
provider: "openai",
|
|
102
|
+
contextWindow: 128000,
|
|
103
|
+
capabilities: {
|
|
104
|
+
vision: false,
|
|
105
|
+
tools: true,
|
|
106
|
+
reasoning: true,
|
|
107
|
+
streaming: true
|
|
108
|
+
},
|
|
109
|
+
costPerMillion: { input: 3, output: 12 }
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
id: "claude-sonnet-4-20250514",
|
|
113
|
+
name: "Claude Sonnet 4",
|
|
114
|
+
provider: "anthropic",
|
|
115
|
+
contextWindow: 200000,
|
|
116
|
+
capabilities: {
|
|
117
|
+
vision: true,
|
|
118
|
+
tools: true,
|
|
119
|
+
reasoning: true,
|
|
120
|
+
streaming: true
|
|
121
|
+
},
|
|
122
|
+
costPerMillion: { input: 3, output: 15 }
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
id: "claude-3-5-sonnet-20241022",
|
|
126
|
+
name: "Claude 3.5 Sonnet",
|
|
127
|
+
provider: "anthropic",
|
|
128
|
+
contextWindow: 200000,
|
|
129
|
+
capabilities: {
|
|
130
|
+
vision: true,
|
|
131
|
+
tools: true,
|
|
132
|
+
reasoning: false,
|
|
133
|
+
streaming: true
|
|
134
|
+
},
|
|
135
|
+
costPerMillion: { input: 3, output: 15 }
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
id: "claude-3-5-haiku-20241022",
|
|
139
|
+
name: "Claude 3.5 Haiku",
|
|
140
|
+
provider: "anthropic",
|
|
141
|
+
contextWindow: 200000,
|
|
142
|
+
capabilities: {
|
|
143
|
+
vision: true,
|
|
144
|
+
tools: true,
|
|
145
|
+
reasoning: false,
|
|
146
|
+
streaming: true
|
|
147
|
+
},
|
|
148
|
+
costPerMillion: { input: 0.8, output: 4 }
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
id: "mistral-large-latest",
|
|
152
|
+
name: "Mistral Large",
|
|
153
|
+
provider: "mistral",
|
|
154
|
+
contextWindow: 128000,
|
|
155
|
+
capabilities: {
|
|
156
|
+
vision: false,
|
|
157
|
+
tools: true,
|
|
158
|
+
reasoning: false,
|
|
159
|
+
streaming: true
|
|
160
|
+
},
|
|
161
|
+
costPerMillion: { input: 2, output: 6 }
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
id: "codestral-latest",
|
|
165
|
+
name: "Codestral",
|
|
166
|
+
provider: "mistral",
|
|
167
|
+
contextWindow: 32000,
|
|
168
|
+
capabilities: {
|
|
169
|
+
vision: false,
|
|
170
|
+
tools: true,
|
|
171
|
+
reasoning: false,
|
|
172
|
+
streaming: true
|
|
173
|
+
},
|
|
174
|
+
costPerMillion: { input: 0.2, output: 0.6 }
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
id: "mistral-small-latest",
|
|
178
|
+
name: "Mistral Small",
|
|
179
|
+
provider: "mistral",
|
|
180
|
+
contextWindow: 32000,
|
|
181
|
+
capabilities: {
|
|
182
|
+
vision: false,
|
|
183
|
+
tools: true,
|
|
184
|
+
reasoning: false,
|
|
185
|
+
streaming: true
|
|
186
|
+
},
|
|
187
|
+
costPerMillion: { input: 0.2, output: 0.6 }
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
id: "gemini-2.0-flash",
|
|
191
|
+
name: "Gemini 2.0 Flash",
|
|
192
|
+
provider: "gemini",
|
|
193
|
+
contextWindow: 1e6,
|
|
194
|
+
capabilities: {
|
|
195
|
+
vision: true,
|
|
196
|
+
tools: true,
|
|
197
|
+
reasoning: false,
|
|
198
|
+
streaming: true
|
|
199
|
+
},
|
|
200
|
+
costPerMillion: { input: 0.075, output: 0.3 }
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
id: "gemini-2.5-pro-preview-06-05",
|
|
204
|
+
name: "Gemini 2.5 Pro",
|
|
205
|
+
provider: "gemini",
|
|
206
|
+
contextWindow: 1e6,
|
|
207
|
+
capabilities: {
|
|
208
|
+
vision: true,
|
|
209
|
+
tools: true,
|
|
210
|
+
reasoning: true,
|
|
211
|
+
streaming: true
|
|
212
|
+
},
|
|
213
|
+
costPerMillion: { input: 1.25, output: 10 }
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
id: "gemini-2.5-flash-preview-05-20",
|
|
217
|
+
name: "Gemini 2.5 Flash",
|
|
218
|
+
provider: "gemini",
|
|
219
|
+
contextWindow: 1e6,
|
|
220
|
+
capabilities: {
|
|
221
|
+
vision: true,
|
|
222
|
+
tools: true,
|
|
223
|
+
reasoning: true,
|
|
224
|
+
streaming: true
|
|
225
|
+
},
|
|
226
|
+
costPerMillion: { input: 0.15, output: 0.6 }
|
|
227
|
+
}
|
|
272
228
|
];
|
|
273
|
-
/**
|
|
274
|
-
* Get models for a specific provider
|
|
275
|
-
*/
|
|
276
229
|
function getModelsForProvider(provider) {
|
|
277
|
-
|
|
230
|
+
return MODELS.filter((m) => m.provider === provider);
|
|
278
231
|
}
|
|
279
|
-
/**
|
|
280
|
-
* Get model info by ID
|
|
281
|
-
*/
|
|
282
232
|
function getModelInfo(modelId) {
|
|
283
|
-
|
|
233
|
+
return MODELS.find((m) => m.id === modelId);
|
|
284
234
|
}
|
|
285
|
-
/**
|
|
286
|
-
* Get recommended models for a provider (legacy format)
|
|
287
|
-
*/
|
|
288
235
|
function getRecommendedModels(provider) {
|
|
289
|
-
|
|
236
|
+
const normalizedProvider = provider === "claude" ? "anthropic" : provider === "custom" ? "openai" : provider;
|
|
237
|
+
return getModelsForProvider(normalizedProvider).map((m) => m.id);
|
|
290
238
|
}
|
|
291
|
-
/**
|
|
292
|
-
* Get default model for a provider
|
|
293
|
-
*/
|
|
294
239
|
function getDefaultModel(provider) {
|
|
295
|
-
|
|
240
|
+
return DEFAULT_MODELS[provider];
|
|
296
241
|
}
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
242
|
+
export {
|
|
243
|
+
getRecommendedModels,
|
|
244
|
+
getModelsForProvider,
|
|
245
|
+
getModelInfo,
|
|
246
|
+
getDefaultModel,
|
|
247
|
+
MODELS,
|
|
248
|
+
DEFAULT_MODELS
|
|
249
|
+
};
|