@aeye/ai 0.1.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/README.md +1324 -0
- package/dist/ai.d.ts +204 -0
- package/dist/ai.d.ts.map +1 -0
- package/dist/ai.js +837 -0
- package/dist/ai.js.map +1 -0
- package/dist/apis/base.d.ts +181 -0
- package/dist/apis/base.d.ts.map +1 -0
- package/dist/apis/base.js +359 -0
- package/dist/apis/base.js.map +1 -0
- package/dist/apis/chat.d.ts +82 -0
- package/dist/apis/chat.d.ts.map +1 -0
- package/dist/apis/chat.js +214 -0
- package/dist/apis/chat.js.map +1 -0
- package/dist/apis/embed.d.ts +27 -0
- package/dist/apis/embed.d.ts.map +1 -0
- package/dist/apis/embed.js +70 -0
- package/dist/apis/embed.js.map +1 -0
- package/dist/apis/image.d.ts +77 -0
- package/dist/apis/image.d.ts.map +1 -0
- package/dist/apis/image.js +313 -0
- package/dist/apis/image.js.map +1 -0
- package/dist/apis/models.d.ts +108 -0
- package/dist/apis/models.d.ts.map +1 -0
- package/dist/apis/models.js +118 -0
- package/dist/apis/models.js.map +1 -0
- package/dist/apis/speech.d.ts +27 -0
- package/dist/apis/speech.d.ts.map +1 -0
- package/dist/apis/speech.js +79 -0
- package/dist/apis/speech.js.map +1 -0
- package/dist/apis/transcribe.d.ts +26 -0
- package/dist/apis/transcribe.d.ts.map +1 -0
- package/dist/apis/transcribe.js +103 -0
- package/dist/apis/transcribe.js.map +1 -0
- package/dist/common.d.ts +10 -0
- package/dist/common.d.ts.map +1 -0
- package/dist/common.js +17 -0
- package/dist/common.js.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -0
- package/dist/modelDetection.d.ts +31 -0
- package/dist/modelDetection.d.ts.map +1 -0
- package/dist/modelDetection.js +78 -0
- package/dist/modelDetection.js.map +1 -0
- package/dist/registry.d.ts +150 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +639 -0
- package/dist/registry.js.map +1 -0
- package/dist/types.d.ts +767 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +8 -0
- package/dist/types.js.map +1 -0
- package/package.json +53 -0
package/dist/registry.js
ADDED
|
@@ -0,0 +1,639 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Model Registry
|
|
3
|
+
*
|
|
4
|
+
* Centralized model management with provider ordering and adapter registration.
|
|
5
|
+
* Provider order ensures deterministic model resolution: first provider to return a model ID wins.
|
|
6
|
+
*/
|
|
7
|
+
import { getModel } from '@aeye/core';
|
|
8
|
+
import { detectTier } from './modelDetection';
|
|
9
|
+
// ============================================================================
|
|
10
|
+
// Provider Capability Detection
|
|
11
|
+
// ============================================================================
|
|
12
|
+
/**
|
|
13
|
+
* Determines which capabilities a provider supports based on its defined methods.
|
|
14
|
+
* Treats streaming and non-streaming methods as equivalent for capability detection.
|
|
15
|
+
*
|
|
16
|
+
* This is useful for:
|
|
17
|
+
* - Filtering providers during model selection
|
|
18
|
+
* - Validating provider compatibility before requests
|
|
19
|
+
* - Displaying provider capabilities in UI
|
|
20
|
+
*
|
|
21
|
+
* @param provider - The provider to inspect
|
|
22
|
+
* @returns Set of capabilities the provider supports
|
|
23
|
+
*
|
|
24
|
+
* @example Basic usage
|
|
25
|
+
* ```typescript
|
|
26
|
+
* import { OpenAIProvider } from '@aeye/openai';
|
|
27
|
+
* import { getProviderCapabilities } from '@aeye/ai';
|
|
28
|
+
*
|
|
29
|
+
* const openai = new OpenAIProvider({ apiKey: '...' });
|
|
30
|
+
* const caps = getProviderCapabilities(openai);
|
|
31
|
+
* console.log(caps);
|
|
32
|
+
* // Set(['chat', 'streaming', 'image', 'audio', 'hearing', 'embedding'])
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @example Checking specific capability
|
|
36
|
+
* ```typescript
|
|
37
|
+
* const openrouter = new OpenRouterProvider({ apiKey: '...' });
|
|
38
|
+
* const caps = getProviderCapabilities(openrouter);
|
|
39
|
+
*
|
|
40
|
+
* if (caps.has('image')) {
|
|
41
|
+
* console.log('Provider supports image generation');
|
|
42
|
+
* } else {
|
|
43
|
+
* console.log('Provider does not support image generation');
|
|
44
|
+
* }
|
|
45
|
+
* // Output: "Provider does not support image generation"
|
|
46
|
+
* ```
|
|
47
|
+
*
|
|
48
|
+
* @example Filtering providers by capability
|
|
49
|
+
* ```typescript
|
|
50
|
+
* const providers = { openai, openrouter, anthropic };
|
|
51
|
+
* const imageProviders = Object.entries(providers)
|
|
52
|
+
* .filter(([name, provider]) => getProviderCapabilities(provider).has('image'))
|
|
53
|
+
* .map(([name]) => name);
|
|
54
|
+
* console.log(imageProviders); // ['openai']
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
export function getProviderCapabilities(provider) {
|
|
58
|
+
const capabilities = new Set();
|
|
59
|
+
// chat - Basic text completion
|
|
60
|
+
if (provider.createExecutor !== undefined || provider.createStreamer !== undefined) {
|
|
61
|
+
capabilities.add('chat');
|
|
62
|
+
}
|
|
63
|
+
// streaming - Real-time response streaming
|
|
64
|
+
if (provider.createStreamer !== undefined) {
|
|
65
|
+
capabilities.add('streaming');
|
|
66
|
+
}
|
|
67
|
+
// image - Image generation (DALL-E, Stable Diffusion, etc.)
|
|
68
|
+
// Either method counts as supporting the capability
|
|
69
|
+
if (provider.generateImage !== undefined || provider.generateImageStream !== undefined) {
|
|
70
|
+
capabilities.add('image');
|
|
71
|
+
}
|
|
72
|
+
if (provider.editImage !== undefined || provider.editImageStream !== undefined) {
|
|
73
|
+
capabilities.add('image');
|
|
74
|
+
}
|
|
75
|
+
// vision - Image understanding/analysis
|
|
76
|
+
// Note: vision is a model capability, not a provider method
|
|
77
|
+
// Vision is handled through chat messages with image content
|
|
78
|
+
// It cannot be detected from provider methods alone
|
|
79
|
+
capabilities.add('vision');
|
|
80
|
+
// audio - Text-to-speech synthesis
|
|
81
|
+
if (provider.speech !== undefined) {
|
|
82
|
+
capabilities.add('audio');
|
|
83
|
+
}
|
|
84
|
+
// hearing - Speech-to-text transcription
|
|
85
|
+
if (provider.transcribe !== undefined || provider.transcribeStream !== undefined) {
|
|
86
|
+
capabilities.add('hearing');
|
|
87
|
+
}
|
|
88
|
+
// embedding - Text embeddings for semantic search
|
|
89
|
+
if (provider.embed !== undefined) {
|
|
90
|
+
capabilities.add('embedding');
|
|
91
|
+
}
|
|
92
|
+
// tools - Function/tool calling
|
|
93
|
+
// Note: This is typically a model capability, not detected from provider methods
|
|
94
|
+
// Function calling is handled through createExecutor with tools parameter
|
|
95
|
+
capabilities.add('tools');
|
|
96
|
+
// json - JSON output mode
|
|
97
|
+
// Note: This is a model capability, not a provider method
|
|
98
|
+
capabilities.add('json');
|
|
99
|
+
// structured - Structured output with schemas
|
|
100
|
+
// Note: This is a model capability, not a provider method
|
|
101
|
+
capabilities.add('structured');
|
|
102
|
+
// reasoning - Extended reasoning (like OpenAI o1)
|
|
103
|
+
// Note: This is a model capability, not a provider method
|
|
104
|
+
capabilities.add('reasoning');
|
|
105
|
+
// zdr - Zero data retention
|
|
106
|
+
// Note: This is a privacy/compliance feature, not detected from provider methods
|
|
107
|
+
capabilities.add('zdr');
|
|
108
|
+
return capabilities;
|
|
109
|
+
}
|
|
110
|
+
// ============================================================================
|
|
111
|
+
// Model Registry
|
|
112
|
+
// ============================================================================
|
|
113
|
+
export class ModelRegistry {
|
|
114
|
+
models = new Map(); // key: "provider/model"
|
|
115
|
+
modelHandlers = new Map();
|
|
116
|
+
providers = new Map();
|
|
117
|
+
providerCapabilities = new Map();
|
|
118
|
+
modelSources = [];
|
|
119
|
+
modelOverrides;
|
|
120
|
+
defaultCostPerMillionTokens;
|
|
121
|
+
defaultWeights;
|
|
122
|
+
weightProfiles;
|
|
123
|
+
constructor(providers, modelOverrides = [], defaultCostPerMillionTokens = 5.0, modelSources = [], defaultWeights, weightProfiles = {}) {
|
|
124
|
+
// Store providers
|
|
125
|
+
this.providers = new Map(Object.entries(providers));
|
|
126
|
+
// Pre-compute provider capabilities for efficient lookup during selection
|
|
127
|
+
for (const [providerName, provider] of this.providers.entries()) {
|
|
128
|
+
const capabilities = getProviderCapabilities(provider);
|
|
129
|
+
this.providerCapabilities.set(providerName, capabilities);
|
|
130
|
+
}
|
|
131
|
+
// Set provider order (determines which provider "wins" for duplicate model IDs)
|
|
132
|
+
this.modelOverrides = modelOverrides;
|
|
133
|
+
this.defaultCostPerMillionTokens = defaultCostPerMillionTokens;
|
|
134
|
+
this.modelSources = modelSources;
|
|
135
|
+
this.defaultWeights = defaultWeights;
|
|
136
|
+
this.weightProfiles = weightProfiles;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Add model sources to the registry
|
|
140
|
+
*/
|
|
141
|
+
addModelSources(sources) {
|
|
142
|
+
this.modelSources.push(...sources);
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Register a model in the registry
|
|
146
|
+
*
|
|
147
|
+
* Always registers under two keys:
|
|
148
|
+
* - model.id (e.g., "gpt-4" or "openai/gpt-4")
|
|
149
|
+
* - provider/model.id (e.g., "openai/gpt-4" or "openrouter/openai/gpt-4")
|
|
150
|
+
*
|
|
151
|
+
* On collision, models are merged
|
|
152
|
+
*/
|
|
153
|
+
registerModel(model) {
|
|
154
|
+
const processedModel = this.applyOverrides(model);
|
|
155
|
+
// Register under both keys
|
|
156
|
+
const keys = [
|
|
157
|
+
model.id, // "gpt-4" or "openai/gpt-4"
|
|
158
|
+
`${model.provider}/${model.id}`, // "openai/gpt-4" or "openrouter/openai/gpt-4"
|
|
159
|
+
];
|
|
160
|
+
for (const key of keys) {
|
|
161
|
+
if (this.models.has(key)) {
|
|
162
|
+
// Merge with existing
|
|
163
|
+
const existing = this.models.get(key);
|
|
164
|
+
const merged = this.mergeModelInfo(existing, processedModel);
|
|
165
|
+
this.models.set(key, merged);
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
this.models.set(key, processedModel);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Register multiple models
|
|
174
|
+
*/
|
|
175
|
+
registerModels(models) {
|
|
176
|
+
for (const model of models) {
|
|
177
|
+
this.registerModel(model);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Get a model by ID (checks all providers in order)
|
|
182
|
+
*/
|
|
183
|
+
getModel(id) {
|
|
184
|
+
// Try with provider prefix first
|
|
185
|
+
if (id.includes('/')) {
|
|
186
|
+
return this.models.get(id);
|
|
187
|
+
}
|
|
188
|
+
let priorityProvider = 10;
|
|
189
|
+
let priorityModel = undefined;
|
|
190
|
+
// Try each provider in order
|
|
191
|
+
for (const [providerName, provider] of this.providers.entries()) {
|
|
192
|
+
const key = `${providerName}/${id}`;
|
|
193
|
+
const priority = provider.priority ?? 10;
|
|
194
|
+
const model = this.models.get(key);
|
|
195
|
+
if (model && (!priorityModel || priority < priorityProvider)) {
|
|
196
|
+
priorityModel = model;
|
|
197
|
+
priorityProvider = priority;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
return priorityModel;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Gets the provider to use for a given model ID
|
|
204
|
+
*
|
|
205
|
+
* @param id
|
|
206
|
+
* @returns
|
|
207
|
+
*/
|
|
208
|
+
getProviderFor(id) {
|
|
209
|
+
let priorityProvider = undefined;
|
|
210
|
+
let priorityKey = undefined;
|
|
211
|
+
for (const [providerKey, provider] of this.providers.entries()) {
|
|
212
|
+
const providerName = provider.name;
|
|
213
|
+
if (id.startsWith(`${providerName}/`) || id.startsWith(`${providerKey}/`)) {
|
|
214
|
+
return [providerKey, provider];
|
|
215
|
+
}
|
|
216
|
+
const priority = provider.priority ?? 10;
|
|
217
|
+
if (!priorityProvider || priority < (priorityProvider.priority ?? 10)) {
|
|
218
|
+
priorityProvider = provider;
|
|
219
|
+
priorityKey = providerKey;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
return priorityKey && priorityProvider ? [priorityKey, priorityProvider] : [];
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* List all models
|
|
226
|
+
*/
|
|
227
|
+
listModels() {
|
|
228
|
+
return Array.from(this.models.values());
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* List models for which we have providers
|
|
232
|
+
*/
|
|
233
|
+
providedModels() {
|
|
234
|
+
return this.listModels().filter(model => this.providers.has(model.provider));
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Search and score models based on criteria
|
|
238
|
+
*/
|
|
239
|
+
searchModels(metadata) {
|
|
240
|
+
const scored = [];
|
|
241
|
+
// Filter list by models we have providers for
|
|
242
|
+
const providedModels = this.providedModels();
|
|
243
|
+
for (const model of providedModels) {
|
|
244
|
+
const score = this.scoreModel(model, metadata);
|
|
245
|
+
if (score.score > 0) {
|
|
246
|
+
scored.push(score);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
// Sort by score descending
|
|
250
|
+
scored.sort((a, b) => b.score - a.score);
|
|
251
|
+
return scored;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Select best model based on criteria
|
|
255
|
+
*/
|
|
256
|
+
selectModel(criteria) {
|
|
257
|
+
// If model explicitly specified, use it
|
|
258
|
+
const model = getModel(criteria.model);
|
|
259
|
+
const modelId = model?.id;
|
|
260
|
+
if (modelId) {
|
|
261
|
+
const model = this.getModel(modelId);
|
|
262
|
+
if (!model) {
|
|
263
|
+
return undefined;
|
|
264
|
+
}
|
|
265
|
+
const provider = this.providers.get(model.provider);
|
|
266
|
+
if (!provider) {
|
|
267
|
+
return undefined;
|
|
268
|
+
}
|
|
269
|
+
// Validate that provider supports required capabilities
|
|
270
|
+
if (criteria.required) {
|
|
271
|
+
const providerCaps = this.providerCapabilities.get(model.provider);
|
|
272
|
+
for (const cap of criteria.required) {
|
|
273
|
+
// Check if provider supports this capability
|
|
274
|
+
const providerSupportsCap = !providerCaps || providerCaps.has(cap);
|
|
275
|
+
if (!providerSupportsCap) {
|
|
276
|
+
// Provider doesn't support this capability, cannot use this model
|
|
277
|
+
return undefined;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
// Validate that model supports required parameters
|
|
282
|
+
if (criteria.requiredParameters && criteria.requiredParameters.length > 0) {
|
|
283
|
+
const optionalParams = criteria.optionalParameters || [];
|
|
284
|
+
for (const param of criteria.requiredParameters) {
|
|
285
|
+
// If this param is marked as optional, skip the requirement check
|
|
286
|
+
if (optionalParams.includes(param)) {
|
|
287
|
+
continue;
|
|
288
|
+
}
|
|
289
|
+
// Check if model supports this parameter
|
|
290
|
+
const modelSupportsParam = model.supportedParameters?.has(param) ?? false;
|
|
291
|
+
if (!modelSupportsParam) {
|
|
292
|
+
// Required parameter not supported by model
|
|
293
|
+
return undefined;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
return {
|
|
298
|
+
model,
|
|
299
|
+
provider,
|
|
300
|
+
providerConfig: provider.config,
|
|
301
|
+
score: 1.0,
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
// Search and score all compatible models
|
|
305
|
+
const scored = this.searchModels(criteria);
|
|
306
|
+
if (scored.length === 0) {
|
|
307
|
+
return undefined;
|
|
308
|
+
}
|
|
309
|
+
const best = scored[0];
|
|
310
|
+
const provider = this.providers.get(best.model.provider);
|
|
311
|
+
if (!provider) {
|
|
312
|
+
return undefined;
|
|
313
|
+
}
|
|
314
|
+
return {
|
|
315
|
+
model: best.model,
|
|
316
|
+
provider,
|
|
317
|
+
providerConfig: provider.config,
|
|
318
|
+
score: best.score,
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* Register a model handler
|
|
323
|
+
*/
|
|
324
|
+
registerHandler(handler) {
|
|
325
|
+
handler.models.forEach(model => this.modelHandlers.set(model, handler));
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Get handler for a model
|
|
329
|
+
*/
|
|
330
|
+
getHandler(provider, model) {
|
|
331
|
+
return this.modelHandlers.get(model) ?? this.modelHandlers.get(`${provider}/${model}`);
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* Get provider info
|
|
335
|
+
*/
|
|
336
|
+
getProvider(name) {
|
|
337
|
+
return this.providers.get(name);
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* Get pre-computed capabilities for a provider
|
|
341
|
+
* @param name - Provider name
|
|
342
|
+
* @returns Set of capabilities the provider supports, or undefined if provider not found
|
|
343
|
+
*/
|
|
344
|
+
getProviderCapabilities(name) {
|
|
345
|
+
return this.providerCapabilities.get(name);
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* Score a model against criteria
|
|
349
|
+
*/
|
|
350
|
+
scoreModel(model, criteria) {
|
|
351
|
+
const result = {
|
|
352
|
+
model,
|
|
353
|
+
score: 0,
|
|
354
|
+
matchedRequired: [],
|
|
355
|
+
matchedOptional: [],
|
|
356
|
+
missingRequired: [],
|
|
357
|
+
};
|
|
358
|
+
// Check provider allowlist/blocklist
|
|
359
|
+
if (criteria.providers) {
|
|
360
|
+
if (criteria.providers.deny?.includes(model.provider)) {
|
|
361
|
+
return result; // score = 0
|
|
362
|
+
}
|
|
363
|
+
if (criteria.providers.allow && !criteria.providers.allow.includes(model.provider)) {
|
|
364
|
+
return result; // score = 0
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
// Check required capabilities against both model AND provider
|
|
368
|
+
if (criteria.required) {
|
|
369
|
+
const providerCaps = this.providerCapabilities.get(model.provider);
|
|
370
|
+
for (const cap of criteria.required) {
|
|
371
|
+
// Check if model has the capability
|
|
372
|
+
const modelHasCap = model.capabilities.has(cap);
|
|
373
|
+
// Check if provider supports the capability
|
|
374
|
+
// If provider capabilities are not cached, assume it's supported (backward compatibility)
|
|
375
|
+
const providerSupportsCap = !providerCaps || providerCaps.has(cap);
|
|
376
|
+
// Both model AND provider must support the capability
|
|
377
|
+
if (modelHasCap && providerSupportsCap) {
|
|
378
|
+
result.matchedRequired.push(cap);
|
|
379
|
+
}
|
|
380
|
+
else {
|
|
381
|
+
result.missingRequired.push(cap);
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
// If any required capabilities are missing, score = 0
|
|
385
|
+
if (result.missingRequired.length > 0) {
|
|
386
|
+
return result;
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
// Check optional capabilities
|
|
390
|
+
if (criteria.optional) {
|
|
391
|
+
for (const cap of criteria.optional) {
|
|
392
|
+
if (model.capabilities.has(cap)) {
|
|
393
|
+
result.matchedOptional.push(cap);
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
// Check required parameters
|
|
398
|
+
if (criteria.requiredParameters && criteria.requiredParameters.length > 0) {
|
|
399
|
+
const optionalParams = criteria.optionalParameters || [];
|
|
400
|
+
for (const param of criteria.requiredParameters) {
|
|
401
|
+
// If this param is marked as optional, skip the requirement check
|
|
402
|
+
if (optionalParams.includes(param)) {
|
|
403
|
+
continue;
|
|
404
|
+
}
|
|
405
|
+
// Check if model supports this parameter
|
|
406
|
+
const modelSupportsParam = model.supportedParameters?.has(param) ?? false;
|
|
407
|
+
if (!modelSupportsParam) {
|
|
408
|
+
// Required parameter not supported by model
|
|
409
|
+
return result; // score = 0
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
// Check minimum context window
|
|
414
|
+
if (criteria.minContextWindow && model.contextWindow && model.contextWindow < criteria.minContextWindow) {
|
|
415
|
+
return result; // score = 0
|
|
416
|
+
}
|
|
417
|
+
if (criteria.tier && model.tier !== criteria.tier) {
|
|
418
|
+
return result; // score = 0
|
|
419
|
+
}
|
|
420
|
+
// Determine weights with priority: metadata.weights > weightProfile > defaultWeights
|
|
421
|
+
let weights;
|
|
422
|
+
if (criteria.weights) {
|
|
423
|
+
weights = criteria.weights;
|
|
424
|
+
}
|
|
425
|
+
else if (criteria.weightProfile && this.weightProfiles[criteria.weightProfile]) {
|
|
426
|
+
weights = this.weightProfiles[criteria.weightProfile];
|
|
427
|
+
}
|
|
428
|
+
else if (this.defaultWeights) {
|
|
429
|
+
weights = this.defaultWeights;
|
|
430
|
+
}
|
|
431
|
+
else {
|
|
432
|
+
weights = { cost: 0.5, speed: 0.3, accuracy: 0.2 };
|
|
433
|
+
}
|
|
434
|
+
result.score = this.calculateWeightedScore(model, weights, criteria);
|
|
435
|
+
return result;
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* Calculate weighted score for a model
|
|
439
|
+
*/
|
|
440
|
+
calculateWeightedScore(model, weights, metadata) {
|
|
441
|
+
let score = 0;
|
|
442
|
+
let weighted = 0;
|
|
443
|
+
// Cost score (lower is better, invert)
|
|
444
|
+
if (weights.cost) {
|
|
445
|
+
// TODO more sophisticated cost modeling
|
|
446
|
+
const avgCost = ((model.pricing.text?.input ?? 0) + (model.pricing.text?.output ?? 0)) / 2;
|
|
447
|
+
const costScore = 1 / (1 + avgCost / 10); // Normalize
|
|
448
|
+
score += weights.cost * costScore;
|
|
449
|
+
if (avgCost > 0) {
|
|
450
|
+
weighted++;
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
// Speed score
|
|
454
|
+
if (weights.speed && model.metrics?.tokensPerSecond) {
|
|
455
|
+
const speedScore = Math.min(model.metrics.tokensPerSecond / 100, 1); // Normalize to 0-1
|
|
456
|
+
score += weights.speed * speedScore;
|
|
457
|
+
if (speedScore > 0) {
|
|
458
|
+
weighted++;
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
// Accuracy score - use metrics if available, otherwise tier-based
|
|
462
|
+
if (weights.accuracy) {
|
|
463
|
+
if (model.metrics?.accuracyScore) {
|
|
464
|
+
score += weights.accuracy * model.metrics.accuracyScore;
|
|
465
|
+
}
|
|
466
|
+
else if (model.tier) {
|
|
467
|
+
// Fallback to tier-based accuracy when metrics not available
|
|
468
|
+
const tierScore = model.tier === 'flagship' ? 1.0 : model.tier === 'efficient' ? 0.7 : 0.5;
|
|
469
|
+
score += weights.accuracy * tierScore;
|
|
470
|
+
}
|
|
471
|
+
if (model.metrics?.accuracyScore || model.tier) {
|
|
472
|
+
weighted++;
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
// Context window score
|
|
476
|
+
if (weights.contextWindow) {
|
|
477
|
+
const contextScore = Math.min(model.contextWindow / 100000, 1); // Normalize
|
|
478
|
+
score += weights.contextWindow * contextScore;
|
|
479
|
+
if (model.contextWindow > 0) {
|
|
480
|
+
weighted++;
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
// Optional capabilities multiplier - models matching more optional caps get a score multiplier
|
|
484
|
+
// This ensures optional capabilities are strongly preferred
|
|
485
|
+
if (metadata.optional && metadata.optional.length > 0) {
|
|
486
|
+
const optionalMatches = metadata.optional.filter(cap => model.capabilities.has(cap)).length;
|
|
487
|
+
const matchRatio = optionalMatches / metadata.optional.length;
|
|
488
|
+
// Apply 1.0x to 2.0x multiplier based on optional capability match rate
|
|
489
|
+
// This allows optional caps to overcome significant cost differences
|
|
490
|
+
const multiplier = 1.0 + matchRatio;
|
|
491
|
+
score *= multiplier;
|
|
492
|
+
}
|
|
493
|
+
// Optional parameters bonus - models supporting optional parameters get a score boost
|
|
494
|
+
if (metadata.optionalParameters && metadata.optionalParameters.length > 0) {
|
|
495
|
+
let supportedOptionalParams = 0;
|
|
496
|
+
for (const param of metadata.optionalParameters) {
|
|
497
|
+
if (model.supportedParameters?.has(param)) {
|
|
498
|
+
supportedOptionalParams++;
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
const matchRatio = supportedOptionalParams / metadata.optionalParameters.length;
|
|
502
|
+
// Apply 1.0x to 1.5x multiplier based on optional parameter match rate
|
|
503
|
+
const multiplier = 1.0 + (matchRatio * 0.5);
|
|
504
|
+
score *= multiplier;
|
|
505
|
+
}
|
|
506
|
+
return weighted === 0 ? Math.max(0.0000001, score) : score;
|
|
507
|
+
}
|
|
508
|
+
/**
|
|
509
|
+
* Apply overrides to a model
|
|
510
|
+
*/
|
|
511
|
+
applyOverrides(model) {
|
|
512
|
+
let result = { ...model };
|
|
513
|
+
for (const override of this.modelOverrides) {
|
|
514
|
+
// Check if override matches
|
|
515
|
+
if (override.provider && override.provider !== model.provider) {
|
|
516
|
+
continue;
|
|
517
|
+
}
|
|
518
|
+
if (override.modelId && override.modelId !== model.id) {
|
|
519
|
+
continue;
|
|
520
|
+
}
|
|
521
|
+
if (override.modelPattern && !override.modelPattern.test(model.id)) {
|
|
522
|
+
continue;
|
|
523
|
+
}
|
|
524
|
+
// Apply overrides
|
|
525
|
+
result = {
|
|
526
|
+
...result,
|
|
527
|
+
...override.overrides,
|
|
528
|
+
// Merge nested objects
|
|
529
|
+
pricing: { ...result.pricing, ...override.overrides.pricing },
|
|
530
|
+
metrics: { ...result.metrics, ...override.overrides.metrics },
|
|
531
|
+
metadata: { ...result.metadata, ...override.overrides.metadata },
|
|
532
|
+
};
|
|
533
|
+
}
|
|
534
|
+
return result;
|
|
535
|
+
}
|
|
536
|
+
/**
|
|
537
|
+
* Merge two ModelInfo objects intelligently
|
|
538
|
+
* Prefers non-default values and combines capabilities
|
|
539
|
+
*/
|
|
540
|
+
mergeModelInfo(base, source) {
|
|
541
|
+
// Merge capabilities
|
|
542
|
+
const mergedCapabilities = new Set([...base.capabilities, ...source.capabilities]);
|
|
543
|
+
// Merge pricing (prefer source if it has non-zero values)
|
|
544
|
+
const mergedPricing = { ...base.pricing, ...source.pricing };
|
|
545
|
+
// Merge metrics (prefer source if available)
|
|
546
|
+
const mergedMetrics = source.metrics ?? base.metrics;
|
|
547
|
+
// Merge metadata (combine, source takes priority for conflicts)
|
|
548
|
+
const mergedMetadata = {
|
|
549
|
+
...base.metadata,
|
|
550
|
+
...source.metadata,
|
|
551
|
+
};
|
|
552
|
+
return {
|
|
553
|
+
id: base.id,
|
|
554
|
+
provider: base.provider,
|
|
555
|
+
name: source.name || base.name,
|
|
556
|
+
capabilities: mergedCapabilities,
|
|
557
|
+
tier: source.tier !== 'experimental' ? source.tier : base.tier,
|
|
558
|
+
pricing: mergedPricing,
|
|
559
|
+
contextWindow: source.contextWindow > 0 ? source.contextWindow : base.contextWindow,
|
|
560
|
+
maxOutputTokens: source.maxOutputTokens ?? base.maxOutputTokens,
|
|
561
|
+
metrics: mergedMetrics,
|
|
562
|
+
metadata: mergedMetadata,
|
|
563
|
+
};
|
|
564
|
+
}
|
|
565
|
+
/**
|
|
566
|
+
* Refresh models from all providers and model sources
|
|
567
|
+
*/
|
|
568
|
+
async refresh() {
|
|
569
|
+
this.models.clear();
|
|
570
|
+
// Step 1: Fetch from model sources (e.g., OpenRouter)
|
|
571
|
+
const sourceModels = new Map();
|
|
572
|
+
for (const source of this.modelSources) {
|
|
573
|
+
try {
|
|
574
|
+
const models = await source.fetchModels();
|
|
575
|
+
for (const model of models) {
|
|
576
|
+
const key = `${model.provider}/${model.id}`;
|
|
577
|
+
sourceModels.set(key, model);
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
catch (error) {
|
|
581
|
+
console.error(`Failed to fetch models from source ${source.name}:`, error);
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
const providers = Array.from(this.providers.entries());
|
|
585
|
+
providers.sort((a, b) => {
|
|
586
|
+
const priorityA = a[1].priority ?? 10;
|
|
587
|
+
const priorityB = b[1].priority ?? 10;
|
|
588
|
+
return priorityA - priorityB;
|
|
589
|
+
});
|
|
590
|
+
// Step 2: Fetch from each provider and merge with source models
|
|
591
|
+
for (const [providerName, provider] of providers) {
|
|
592
|
+
try {
|
|
593
|
+
// Skip if provider doesn't implement listModels
|
|
594
|
+
if (!provider.listModels) {
|
|
595
|
+
continue;
|
|
596
|
+
}
|
|
597
|
+
const modelInfos = await provider.listModels();
|
|
598
|
+
// For each model from provider
|
|
599
|
+
for (const modelInfo of modelInfos) {
|
|
600
|
+
// Create key for looking up source info
|
|
601
|
+
const key = `${providerName}/${modelInfo.id}`;
|
|
602
|
+
// Create base model with defaults
|
|
603
|
+
let fullModel = {
|
|
604
|
+
id: modelInfo.id,
|
|
605
|
+
provider: providerName,
|
|
606
|
+
name: modelInfo.name || modelInfo.id,
|
|
607
|
+
capabilities: modelInfo.capabilities || new Set(['chat', 'streaming']),
|
|
608
|
+
tier: modelInfo.tier || detectTier(modelInfo.name || modelInfo.id),
|
|
609
|
+
pricing: modelInfo.pricing || {
|
|
610
|
+
inputTokensPer1M: this.defaultCostPerMillionTokens,
|
|
611
|
+
outputTokensPer1M: this.defaultCostPerMillionTokens * 2,
|
|
612
|
+
},
|
|
613
|
+
contextWindow: modelInfo.contextWindow || 8192,
|
|
614
|
+
maxOutputTokens: modelInfo.maxOutputTokens,
|
|
615
|
+
metrics: modelInfo.metrics,
|
|
616
|
+
metadata: modelInfo.metadata || {},
|
|
617
|
+
};
|
|
618
|
+
// Merge with source model info if available
|
|
619
|
+
const sourceModel = sourceModels.get(key);
|
|
620
|
+
if (sourceModel) {
|
|
621
|
+
fullModel = this.mergeModelInfo(fullModel, sourceModel);
|
|
622
|
+
}
|
|
623
|
+
this.registerModel(fullModel);
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
catch (error) {
|
|
627
|
+
// Continue with other providers if one fails
|
|
628
|
+
console.error(`Failed to fetch models from ${providerName}:`, error);
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
// Step 3: Register any source models that weren't in providers
|
|
632
|
+
for (const [key, sourceModel] of sourceModels.entries()) {
|
|
633
|
+
if (!this.models.has(key)) {
|
|
634
|
+
this.registerModel(sourceModel);
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAA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