n8n-nodes-openrouter-selector 0.3.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 +307 -0
- package/dist/credentials/OpenRouterApi.credentials.d.ts +10 -0
- package/dist/credentials/OpenRouterApi.credentials.d.ts.map +1 -0
- package/dist/credentials/OpenRouterApi.credentials.js +38 -0
- package/dist/credentials/OpenRouterApi.credentials.js.map +1 -0
- package/dist/credentials/SupabaseModelCatalogApi.credentials.d.ts +10 -0
- package/dist/credentials/SupabaseModelCatalogApi.credentials.d.ts.map +1 -0
- package/dist/credentials/SupabaseModelCatalogApi.credentials.js +51 -0
- package/dist/credentials/SupabaseModelCatalogApi.credentials.js.map +1 -0
- package/dist/nodes/OpenRouterChatCompletion/OpenRouterChatCompletion.node.d.ts +11 -0
- package/dist/nodes/OpenRouterChatCompletion/OpenRouterChatCompletion.node.d.ts.map +1 -0
- package/dist/nodes/OpenRouterChatCompletion/OpenRouterChatCompletion.node.js +300 -0
- package/dist/nodes/OpenRouterChatCompletion/OpenRouterChatCompletion.node.js.map +1 -0
- package/dist/nodes/OpenRouterChatCompletion/openrouter-chat.svg +13 -0
- package/dist/nodes/OpenRouterModelSelector/OpenRouterModelSelector.node.d.ts +14 -0
- package/dist/nodes/OpenRouterModelSelector/OpenRouterModelSelector.node.d.ts.map +1 -0
- package/dist/nodes/OpenRouterModelSelector/OpenRouterModelSelector.node.js +412 -0
- package/dist/nodes/OpenRouterModelSelector/OpenRouterModelSelector.node.js.map +1 -0
- package/dist/nodes/OpenRouterModelSelector/modelScoring.d.ts +28 -0
- package/dist/nodes/OpenRouterModelSelector/modelScoring.d.ts.map +1 -0
- package/dist/nodes/OpenRouterModelSelector/modelScoring.js +384 -0
- package/dist/nodes/OpenRouterModelSelector/modelScoring.js.map +1 -0
- package/dist/nodes/OpenRouterModelSelector/openrouter-selector.svg +37 -0
- package/dist/nodes/OpenRouterModelSelector/taskProfiles.d.ts +39 -0
- package/dist/nodes/OpenRouterModelSelector/taskProfiles.d.ts.map +1 -0
- package/dist/nodes/OpenRouterModelSelector/taskProfiles.js +271 -0
- package/dist/nodes/OpenRouterModelSelector/taskProfiles.js.map +1 -0
- package/dist/nodes/OpenRouterModelSelector/types.d.ts +217 -0
- package/dist/nodes/OpenRouterModelSelector/types.d.ts.map +1 -0
- package/dist/nodes/OpenRouterModelSelector/types.js +44 -0
- package/dist/nodes/OpenRouterModelSelector/types.js.map +1 -0
- package/dist/nodes/OpenRouterSmartChat/OpenRouterSmartChat.node.d.ts +11 -0
- package/dist/nodes/OpenRouterSmartChat/OpenRouterSmartChat.node.d.ts.map +1 -0
- package/dist/nodes/OpenRouterSmartChat/OpenRouterSmartChat.node.js +657 -0
- package/dist/nodes/OpenRouterSmartChat/OpenRouterSmartChat.node.js.map +1 -0
- package/dist/nodes/OpenRouterSmartChat/modelScoring.d.ts +28 -0
- package/dist/nodes/OpenRouterSmartChat/modelScoring.d.ts.map +1 -0
- package/dist/nodes/OpenRouterSmartChat/modelScoring.js +384 -0
- package/dist/nodes/OpenRouterSmartChat/modelScoring.js.map +1 -0
- package/dist/nodes/OpenRouterSmartChat/openrouter-smart.svg +11 -0
- package/dist/nodes/OpenRouterSmartChat/taskProfiles.d.ts +39 -0
- package/dist/nodes/OpenRouterSmartChat/taskProfiles.d.ts.map +1 -0
- package/dist/nodes/OpenRouterSmartChat/taskProfiles.js +271 -0
- package/dist/nodes/OpenRouterSmartChat/taskProfiles.js.map +1 -0
- package/dist/nodes/OpenRouterSmartChat/types.d.ts +217 -0
- package/dist/nodes/OpenRouterSmartChat/types.d.ts.map +1 -0
- package/dist/nodes/OpenRouterSmartChat/types.js +44 -0
- package/dist/nodes/OpenRouterSmartChat/types.js.map +1 -0
- package/dist/nodes/OpenRouterSmartEmbedding/OpenRouterEmbeddings.class.d.ts +48 -0
- package/dist/nodes/OpenRouterSmartEmbedding/OpenRouterEmbeddings.class.d.ts.map +1 -0
- package/dist/nodes/OpenRouterSmartEmbedding/OpenRouterEmbeddings.class.js +265 -0
- package/dist/nodes/OpenRouterSmartEmbedding/OpenRouterEmbeddings.class.js.map +1 -0
- package/dist/nodes/OpenRouterSmartEmbedding/OpenRouterSmartEmbedding.node.d.ts +16 -0
- package/dist/nodes/OpenRouterSmartEmbedding/OpenRouterSmartEmbedding.node.d.ts.map +1 -0
- package/dist/nodes/OpenRouterSmartEmbedding/OpenRouterSmartEmbedding.node.js +177 -0
- package/dist/nodes/OpenRouterSmartEmbedding/OpenRouterSmartEmbedding.node.js.map +1 -0
- package/dist/nodes/OpenRouterSmartEmbedding/openrouter-embed.svg +22 -0
- package/dist/nodes/shared/contentAnalyzer.d.ts +16 -0
- package/dist/nodes/shared/contentAnalyzer.d.ts.map +1 -0
- package/dist/nodes/shared/contentAnalyzer.js +256 -0
- package/dist/nodes/shared/contentAnalyzer.js.map +1 -0
- package/dist/nodes/shared/embeddingScoring.d.ts +12 -0
- package/dist/nodes/shared/embeddingScoring.d.ts.map +1 -0
- package/dist/nodes/shared/embeddingScoring.js +329 -0
- package/dist/nodes/shared/embeddingScoring.js.map +1 -0
- package/dist/nodes/shared/types.d.ts +131 -0
- package/dist/nodes/shared/types.d.ts.map +1 -0
- package/dist/nodes/shared/types.js +24 -0
- package/dist/nodes/shared/types.js.map +1 -0
- package/package.json +67 -0
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Model Scoring Algorithm
|
|
4
|
+
*
|
|
5
|
+
* Deterministic scoring based on external benchmarks.
|
|
6
|
+
* Formula: score = (benchmark_fit × 0.4) + (task_fit × 0.3) + (budget_fit × 0.2) + (capability_fit × 0.1)
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.scoreModel = scoreModel;
|
|
10
|
+
exports.scoreAndRankModels = scoreAndRankModels;
|
|
11
|
+
exports.passesFilters = passesFilters;
|
|
12
|
+
exports.calculatePricing = calculatePricing;
|
|
13
|
+
exports.createManualSelection = createManualSelection;
|
|
14
|
+
const taskProfiles_1 = require("./taskProfiles");
|
|
15
|
+
/**
|
|
16
|
+
* Main scoring function - scores a single model for a given task/budget
|
|
17
|
+
*/
|
|
18
|
+
function scoreModel(model, task, budget, filters) {
|
|
19
|
+
// Check if model passes filters first
|
|
20
|
+
if (!passesFilters(model, filters)) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
const profile = (0, taskProfiles_1.getTaskProfile)(task);
|
|
24
|
+
const pricing = calculatePricing(model.model);
|
|
25
|
+
const provider = model.model.model.split('/')[0];
|
|
26
|
+
// Calculate individual score components
|
|
27
|
+
const benchmarkScore = calculateBenchmarkScore(model.benchmarks, profile);
|
|
28
|
+
const taskScore = calculateTaskScore(model, profile);
|
|
29
|
+
const budgetScore = calculateBudgetScore(pricing, budget);
|
|
30
|
+
const capabilityScore = calculateCapabilityScore(model, profile);
|
|
31
|
+
// Apply provider boost
|
|
32
|
+
const providerBoost = (0, taskProfiles_1.getProviderBoost)(task, provider);
|
|
33
|
+
// Calculate breakdown (before boost)
|
|
34
|
+
const breakdown = {
|
|
35
|
+
benchmarkFit: benchmarkScore,
|
|
36
|
+
taskFit: taskScore,
|
|
37
|
+
budgetFit: budgetScore,
|
|
38
|
+
capabilityFit: capabilityScore,
|
|
39
|
+
providerBonus: Math.round((providerBoost - 1) * 100) / 10, // e.g., 1.15 -> 1.5
|
|
40
|
+
};
|
|
41
|
+
// Total score with boost
|
|
42
|
+
const baseScore = benchmarkScore * 0.4 +
|
|
43
|
+
taskScore * 0.3 +
|
|
44
|
+
budgetScore * 0.2 +
|
|
45
|
+
capabilityScore * 0.1;
|
|
46
|
+
const totalScore = Math.round(baseScore * providerBoost * 10) / 10;
|
|
47
|
+
// Generate reasoning
|
|
48
|
+
const reasoning = generateReasoning(model, profile, breakdown, providerBoost, budget);
|
|
49
|
+
return {
|
|
50
|
+
modelId: model.model.model,
|
|
51
|
+
provider,
|
|
52
|
+
displayName: model.mapping?.canonical_name ?? model.model.display_name,
|
|
53
|
+
contextLength: model.model.context_length,
|
|
54
|
+
supportsJson: model.model.supports_json ?? checkJsonSupport(model.model),
|
|
55
|
+
modality: model.model.modality ?? 'text->text',
|
|
56
|
+
pricing,
|
|
57
|
+
score: totalScore,
|
|
58
|
+
scoreBreakdown: breakdown,
|
|
59
|
+
reasoning,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Score multiple models and return top N
|
|
64
|
+
*/
|
|
65
|
+
function scoreAndRankModels(models, task, budget, filters, topN) {
|
|
66
|
+
const scored = [];
|
|
67
|
+
for (const model of models) {
|
|
68
|
+
const result = scoreModel(model, task, budget, filters);
|
|
69
|
+
if (result) {
|
|
70
|
+
scored.push(result);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
// Sort by score descending
|
|
74
|
+
scored.sort((a, b) => b.score - a.score);
|
|
75
|
+
// Return top N
|
|
76
|
+
return scored.slice(0, topN);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Check if model passes all filters
|
|
80
|
+
*/
|
|
81
|
+
function passesFilters(model, filters) {
|
|
82
|
+
const { model: m } = model;
|
|
83
|
+
// Context length filter
|
|
84
|
+
if (filters.minContextLength && m.context_length < filters.minContextLength) {
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
// Vision filter
|
|
88
|
+
if (filters.requireVision) {
|
|
89
|
+
const modality = m.modality?.toLowerCase() ?? '';
|
|
90
|
+
if (!modality.includes('image') && !modality.includes('vision')) {
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
// JSON mode filter (approximate check based on model capabilities)
|
|
95
|
+
if (filters.requireJsonMode && !checkJsonSupport(m)) {
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
// Max cost filter (user input is per-1K, convert to per-M for comparison)
|
|
99
|
+
if (filters.maxCostPerK) {
|
|
100
|
+
const pricing = calculatePricing(m);
|
|
101
|
+
const maxCostPerM = filters.maxCostPerK * 1000;
|
|
102
|
+
if (pricing.combinedPerMUsd > maxCostPerM) {
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
// Provider whitelist
|
|
107
|
+
if (filters.providerWhitelist && filters.providerWhitelist.length > 0) {
|
|
108
|
+
const provider = m.model.split('/')[0].toLowerCase();
|
|
109
|
+
if (!filters.providerWhitelist.some((p) => p.toLowerCase() === provider)) {
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
// Provider blacklist
|
|
114
|
+
if (filters.providerBlacklist && filters.providerBlacklist.length > 0) {
|
|
115
|
+
const provider = m.model.split('/')[0].toLowerCase();
|
|
116
|
+
if (filters.providerBlacklist.some((p) => p.toLowerCase() === provider)) {
|
|
117
|
+
return false;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return true;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Calculate benchmark-based score (0-100)
|
|
124
|
+
*/
|
|
125
|
+
function calculateBenchmarkScore(benchmarks, profile) {
|
|
126
|
+
if (!benchmarks) {
|
|
127
|
+
// No benchmark data - return conservative score
|
|
128
|
+
return 30;
|
|
129
|
+
}
|
|
130
|
+
const weights = profile.benchmarkWeights;
|
|
131
|
+
let totalWeight = 0;
|
|
132
|
+
let weightedSum = 0;
|
|
133
|
+
// Process each benchmark weight
|
|
134
|
+
for (const [benchmarkKey, weight] of Object.entries(weights)) {
|
|
135
|
+
if (weight <= 0)
|
|
136
|
+
continue;
|
|
137
|
+
const value = benchmarks[benchmarkKey];
|
|
138
|
+
if (typeof value !== 'number' || value === null)
|
|
139
|
+
continue;
|
|
140
|
+
// Normalize the benchmark value to 0-100 scale
|
|
141
|
+
const normalizedValue = normalizeBenchmarkValue(benchmarkKey, value);
|
|
142
|
+
weightedSum += normalizedValue * weight;
|
|
143
|
+
totalWeight += weight;
|
|
144
|
+
}
|
|
145
|
+
if (totalWeight === 0) {
|
|
146
|
+
return 30; // Default if no matching benchmarks
|
|
147
|
+
}
|
|
148
|
+
// Normalize to 0-100
|
|
149
|
+
return Math.min(100, Math.max(0, Math.round(weightedSum / totalWeight)));
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Normalize different benchmark scales to 0-100
|
|
153
|
+
*/
|
|
154
|
+
function normalizeBenchmarkValue(benchmarkKey, value) {
|
|
155
|
+
// LMSYS Elo typically ranges from 900-1400
|
|
156
|
+
if (benchmarkKey.startsWith('lmsys_elo')) {
|
|
157
|
+
// Map 900-1400 to 0-100
|
|
158
|
+
return Math.min(100, Math.max(0, ((value - 900) / 500) * 100));
|
|
159
|
+
}
|
|
160
|
+
// Artificial Analysis indices are already 0-100
|
|
161
|
+
if (benchmarkKey.startsWith('aa_')) {
|
|
162
|
+
return Math.min(100, Math.max(0, value));
|
|
163
|
+
}
|
|
164
|
+
// LiveBench scores are typically 0-100 or percentage
|
|
165
|
+
if (benchmarkKey.startsWith('livebench_')) {
|
|
166
|
+
return Math.min(100, Math.max(0, value));
|
|
167
|
+
}
|
|
168
|
+
// Default: assume 0-100 scale
|
|
169
|
+
return Math.min(100, Math.max(0, value));
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Calculate task fit score (0-100) based on model characteristics
|
|
173
|
+
*/
|
|
174
|
+
function calculateTaskScore(model, profile) {
|
|
175
|
+
let score = 50; // Base score
|
|
176
|
+
const { model: m } = model;
|
|
177
|
+
// Context length bonus
|
|
178
|
+
if (m.context_length >= profile.minContextLength * 2) {
|
|
179
|
+
score += 20; // Generous context
|
|
180
|
+
}
|
|
181
|
+
else if (m.context_length >= profile.minContextLength) {
|
|
182
|
+
score += 10; // Meets requirement
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
score -= 20; // Below requirement
|
|
186
|
+
}
|
|
187
|
+
// Vision requirement
|
|
188
|
+
if (profile.requireVision) {
|
|
189
|
+
const modality = m.modality?.toLowerCase() ?? '';
|
|
190
|
+
if (modality.includes('image') || modality.includes('vision')) {
|
|
191
|
+
score += 15;
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
score -= 30;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
// JSON mode requirement
|
|
198
|
+
if (profile.requireJsonMode) {
|
|
199
|
+
if (checkJsonSupport(m)) {
|
|
200
|
+
score += 10;
|
|
201
|
+
}
|
|
202
|
+
else {
|
|
203
|
+
score -= 20;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
// Recent model bonus (prefer newer models)
|
|
207
|
+
const createdAt = new Date(m.created_at);
|
|
208
|
+
const monthsOld = (Date.now() - createdAt.getTime()) / (1000 * 60 * 60 * 24 * 30);
|
|
209
|
+
if (monthsOld < 6) {
|
|
210
|
+
score += 5; // Very recent
|
|
211
|
+
}
|
|
212
|
+
else if (monthsOld > 24) {
|
|
213
|
+
score -= 5; // Getting old
|
|
214
|
+
}
|
|
215
|
+
return Math.min(100, Math.max(0, score));
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Calculate budget fit score (0-100)
|
|
219
|
+
*/
|
|
220
|
+
function calculateBudgetScore(pricing, budget) {
|
|
221
|
+
// Cost is now per 1M tokens
|
|
222
|
+
const cost = pricing.combinedPerMUsd;
|
|
223
|
+
if (budget === 'cheap') {
|
|
224
|
+
// For cheap: lower cost = higher score (thresholds in $/M)
|
|
225
|
+
if (cost <= 0.1)
|
|
226
|
+
return 100; // $0.10/M or less
|
|
227
|
+
if (cost <= 0.5)
|
|
228
|
+
return 90; // $0.50/M
|
|
229
|
+
if (cost <= 1)
|
|
230
|
+
return 70; // $1/M
|
|
231
|
+
if (cost <= 5)
|
|
232
|
+
return 40; // $5/M
|
|
233
|
+
return 20;
|
|
234
|
+
}
|
|
235
|
+
if (budget === 'balanced') {
|
|
236
|
+
// For balanced: moderate cost is ideal (thresholds in $/M)
|
|
237
|
+
if (cost <= 1)
|
|
238
|
+
return 85; // Very cheap, might sacrifice quality
|
|
239
|
+
if (cost <= 5)
|
|
240
|
+
return 100; // Sweet spot $1-5/M
|
|
241
|
+
if (cost <= 10)
|
|
242
|
+
return 90; // $10/M
|
|
243
|
+
if (cost <= 20)
|
|
244
|
+
return 70; // $20/M
|
|
245
|
+
return 50;
|
|
246
|
+
}
|
|
247
|
+
// For premium: quality over cost, but extremely expensive still penalized
|
|
248
|
+
if (cost <= 10)
|
|
249
|
+
return 80; // Cheap for premium might be lower quality
|
|
250
|
+
if (cost <= 50)
|
|
251
|
+
return 100; // Good premium range $10-50/M
|
|
252
|
+
if (cost <= 100)
|
|
253
|
+
return 90; // $100/M
|
|
254
|
+
return 75; // Very expensive
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Calculate capability fit score (0-100)
|
|
258
|
+
*/
|
|
259
|
+
function calculateCapabilityScore(model, profile) {
|
|
260
|
+
let score = 50;
|
|
261
|
+
const { model: m } = model;
|
|
262
|
+
// Context length (scaled bonus)
|
|
263
|
+
const contextK = m.context_length / 1000;
|
|
264
|
+
if (contextK >= 128) {
|
|
265
|
+
score += 20; // Very long context
|
|
266
|
+
}
|
|
267
|
+
else if (contextK >= 32) {
|
|
268
|
+
score += 10;
|
|
269
|
+
}
|
|
270
|
+
else if (contextK < 8) {
|
|
271
|
+
score -= 10; // Limited context
|
|
272
|
+
}
|
|
273
|
+
// Has benchmark data (more reliable)
|
|
274
|
+
if (model.benchmarks) {
|
|
275
|
+
score += 10;
|
|
276
|
+
}
|
|
277
|
+
// Has mapping (verified model)
|
|
278
|
+
if (model.mapping?.verified) {
|
|
279
|
+
score += 10;
|
|
280
|
+
}
|
|
281
|
+
return Math.min(100, Math.max(0, score));
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Check if model likely supports JSON mode
|
|
285
|
+
*/
|
|
286
|
+
function checkJsonSupport(model) {
|
|
287
|
+
// Use database field if available
|
|
288
|
+
if (model.supports_json !== undefined) {
|
|
289
|
+
return model.supports_json;
|
|
290
|
+
}
|
|
291
|
+
// Fallback: Known JSON-capable model families
|
|
292
|
+
const modelId = model.model.toLowerCase();
|
|
293
|
+
const jsonCapablePatterns = [
|
|
294
|
+
'gpt-4',
|
|
295
|
+
'gpt-3.5-turbo',
|
|
296
|
+
'claude-3',
|
|
297
|
+
'claude-sonnet',
|
|
298
|
+
'claude-opus',
|
|
299
|
+
'gemini',
|
|
300
|
+
'mistral-large',
|
|
301
|
+
'mixtral',
|
|
302
|
+
];
|
|
303
|
+
return jsonCapablePatterns.some((pattern) => modelId.includes(pattern));
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* Calculate pricing from model data
|
|
307
|
+
*/
|
|
308
|
+
function calculatePricing(model) {
|
|
309
|
+
// DB stores per-token prices (despite column name suggesting per-1K)
|
|
310
|
+
const pricePerTokenPrompt = model.price_prompt_per_1k_usd ?? 0;
|
|
311
|
+
const pricePerTokenCompletion = model.price_completion_per_1k_usd ?? 0;
|
|
312
|
+
// Convert to per-1M for display
|
|
313
|
+
const promptPerM = pricePerTokenPrompt * 1_000_000;
|
|
314
|
+
const completionPerM = pricePerTokenCompletion * 1_000_000;
|
|
315
|
+
return {
|
|
316
|
+
promptPerMUsd: promptPerM,
|
|
317
|
+
completionPerMUsd: completionPerM,
|
|
318
|
+
combinedPerMUsd: (promptPerM + completionPerM) / 2,
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* Generate human-readable reasoning for score
|
|
323
|
+
*/
|
|
324
|
+
function generateReasoning(model, profile, breakdown, providerBoost, budget) {
|
|
325
|
+
const parts = [];
|
|
326
|
+
const provider = model.model.model.split('/')[0];
|
|
327
|
+
// Benchmark fit comment
|
|
328
|
+
if (breakdown.benchmarkFit >= 80) {
|
|
329
|
+
parts.push(`Excellent benchmark performance for ${profile.displayName}`);
|
|
330
|
+
}
|
|
331
|
+
else if (breakdown.benchmarkFit >= 60) {
|
|
332
|
+
parts.push(`Good benchmark scores`);
|
|
333
|
+
}
|
|
334
|
+
else if (breakdown.benchmarkFit < 40) {
|
|
335
|
+
parts.push(`Limited benchmark data`);
|
|
336
|
+
}
|
|
337
|
+
// Budget comment
|
|
338
|
+
if (breakdown.budgetFit >= 90) {
|
|
339
|
+
parts.push(`ideal ${budget} pricing`);
|
|
340
|
+
}
|
|
341
|
+
else if (breakdown.budgetFit >= 70) {
|
|
342
|
+
parts.push(`acceptable cost`);
|
|
343
|
+
}
|
|
344
|
+
else {
|
|
345
|
+
parts.push(`cost concerns for ${budget} budget`);
|
|
346
|
+
}
|
|
347
|
+
// Provider bonus
|
|
348
|
+
if (providerBoost > 1.0) {
|
|
349
|
+
const boostPercent = Math.round((providerBoost - 1) * 100);
|
|
350
|
+
parts.push(`${provider} provider bonus (+${boostPercent}%)`);
|
|
351
|
+
}
|
|
352
|
+
// Capability highlights
|
|
353
|
+
if (model.model.context_length >= 100000) {
|
|
354
|
+
parts.push(`very long context (${Math.round(model.model.context_length / 1000)}K)`);
|
|
355
|
+
}
|
|
356
|
+
return parts.join(', ') + '.';
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* Create a manually selected model result (bypasses scoring)
|
|
360
|
+
*/
|
|
361
|
+
function createManualSelection(model) {
|
|
362
|
+
const pricing = calculatePricing(model.model);
|
|
363
|
+
const provider = model.model.model.split('/')[0];
|
|
364
|
+
return {
|
|
365
|
+
modelId: model.model.model,
|
|
366
|
+
provider,
|
|
367
|
+
displayName: model.mapping?.canonical_name ?? model.model.display_name,
|
|
368
|
+
contextLength: model.model.context_length,
|
|
369
|
+
supportsJson: model.model.supports_json ?? checkJsonSupport(model.model),
|
|
370
|
+
modality: model.model.modality ?? 'text->text',
|
|
371
|
+
pricing,
|
|
372
|
+
score: 0, // Not scored
|
|
373
|
+
scoreBreakdown: {
|
|
374
|
+
benchmarkFit: 0,
|
|
375
|
+
taskFit: 0,
|
|
376
|
+
budgetFit: 0,
|
|
377
|
+
capabilityFit: 0,
|
|
378
|
+
providerBonus: 0,
|
|
379
|
+
},
|
|
380
|
+
reasoning: 'Manually selected model.',
|
|
381
|
+
manuallySelected: true,
|
|
382
|
+
};
|
|
383
|
+
}
|
|
384
|
+
//# sourceMappingURL=modelScoring.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modelScoring.js","sourceRoot":"","sources":["../../../nodes/OpenRouterModelSelector/modelScoring.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAqBH,gCA+DC;AAKD,gDAqBC;AAKD,sCAkDC;AA0ND,4CAcC;AAkDD,sDAyBC;AAxcD,iDAAkE;AAElE;;GAEG;AACH,SAAgB,UAAU,CACxB,KAA0B,EAC1B,IAAkB,EAClB,MAAwB,EACxB,OAAoB;IAEpB,sCAAsC;IACtC,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,OAAO,CAAC,EAAE,CAAC;QACnC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,OAAO,GAAG,IAAA,6BAAc,EAAC,IAAI,CAAC,CAAC;IACrC,MAAM,OAAO,GAAG,gBAAgB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC9C,MAAM,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAEjD,wCAAwC;IACxC,MAAM,cAAc,GAAG,uBAAuB,CAAC,KAAK,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IAC1E,MAAM,SAAS,GAAG,kBAAkB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACrD,MAAM,WAAW,GAAG,oBAAoB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC1D,MAAM,eAAe,GAAG,wBAAwB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAEjE,uBAAuB;IACvB,MAAM,aAAa,GAAG,IAAA,+BAAgB,EAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAEvD,qCAAqC;IACrC,M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|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128 128" fill="none">
|
|
2
|
+
<!-- Background circle -->
|
|
3
|
+
<circle cx="64" cy="64" r="60" fill="#1a1a2e"/>
|
|
4
|
+
|
|
5
|
+
<!-- Router/network symbol -->
|
|
6
|
+
<path d="M64 28L64 48" stroke="#00d4aa" stroke-width="4" stroke-linecap="round"/>
|
|
7
|
+
<path d="M64 80L64 100" stroke="#00d4aa" stroke-width="4" stroke-linecap="round"/>
|
|
8
|
+
<path d="M28 64L48 64" stroke="#00d4aa" stroke-width="4" stroke-linecap="round"/>
|
|
9
|
+
<path d="M80 64L100 64" stroke="#00d4aa" stroke-width="4" stroke-linecap="round"/>
|
|
10
|
+
|
|
11
|
+
<!-- Central hub -->
|
|
12
|
+
<circle cx="64" cy="64" r="16" fill="#00d4aa"/>
|
|
13
|
+
|
|
14
|
+
<!-- AI brain pattern in center -->
|
|
15
|
+
<path d="M58 60C58 60 60 56 64 56C68 56 70 60 70 60" stroke="#1a1a2e" stroke-width="2" stroke-linecap="round"/>
|
|
16
|
+
<path d="M58 68C58 68 60 72 64 72C68 72 70 68 70 68" stroke="#1a1a2e" stroke-width="2" stroke-linecap="round"/>
|
|
17
|
+
<circle cx="60" cy="64" r="2" fill="#1a1a2e"/>
|
|
18
|
+
<circle cx="68" cy="64" r="2" fill="#1a1a2e"/>
|
|
19
|
+
|
|
20
|
+
<!-- Connection nodes -->
|
|
21
|
+
<circle cx="64" cy="28" r="6" fill="#ff6b6b"/>
|
|
22
|
+
<circle cx="64" cy="100" r="6" fill="#4ecdc4"/>
|
|
23
|
+
<circle cx="28" cy="64" r="6" fill="#ffe66d"/>
|
|
24
|
+
<circle cx="100" cy="64" r="6" fill="#95e1d3"/>
|
|
25
|
+
|
|
26
|
+
<!-- Diagonal connections -->
|
|
27
|
+
<path d="M44 44L52 52" stroke="#00d4aa" stroke-width="3" stroke-linecap="round" opacity="0.6"/>
|
|
28
|
+
<path d="M84 44L76 52" stroke="#00d4aa" stroke-width="3" stroke-linecap="round" opacity="0.6"/>
|
|
29
|
+
<path d="M44 84L52 76" stroke="#00d4aa" stroke-width="3" stroke-linecap="round" opacity="0.6"/>
|
|
30
|
+
<path d="M84 84L76 76" stroke="#00d4aa" stroke-width="3" stroke-linecap="round" opacity="0.6"/>
|
|
31
|
+
|
|
32
|
+
<!-- Corner nodes (smaller) -->
|
|
33
|
+
<circle cx="40" cy="40" r="4" fill="#a8e6cf"/>
|
|
34
|
+
<circle cx="88" cy="40" r="4" fill="#dcedc1"/>
|
|
35
|
+
<circle cx="40" cy="88" r="4" fill="#ffd3b6"/>
|
|
36
|
+
<circle cx="88" cy="88" r="4" fill="#ffaaa5"/>
|
|
37
|
+
</svg>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Task Profiles Configuration
|
|
3
|
+
*
|
|
4
|
+
* Defines which benchmarks are relevant for each task category
|
|
5
|
+
* and provider-specific boosts based on empirical performance.
|
|
6
|
+
*/
|
|
7
|
+
import type { TaskCategory, TaskProfile } from './types';
|
|
8
|
+
/**
|
|
9
|
+
* Task Profiles
|
|
10
|
+
*
|
|
11
|
+
* Each profile defines:
|
|
12
|
+
* - displayName: Human-readable task name
|
|
13
|
+
* - benchmarkWeights: Which benchmarks matter and their relative importance (should sum to 1.0)
|
|
14
|
+
* - providerBoosts: Multipliers for providers known to excel at this task
|
|
15
|
+
* - minContextLength: Minimum context window required
|
|
16
|
+
* - Optional requirements (JSON mode, vision, etc.)
|
|
17
|
+
*/
|
|
18
|
+
export declare const TASK_PROFILES: Record<TaskCategory, TaskProfile>;
|
|
19
|
+
/**
|
|
20
|
+
* Get task profile by category
|
|
21
|
+
*/
|
|
22
|
+
export declare function getTaskProfile(task: TaskCategory): TaskProfile;
|
|
23
|
+
/**
|
|
24
|
+
* Get all available task categories
|
|
25
|
+
*/
|
|
26
|
+
export declare function getTaskCategories(): TaskCategory[];
|
|
27
|
+
/**
|
|
28
|
+
* Get provider boost for a specific task and provider
|
|
29
|
+
*/
|
|
30
|
+
export declare function getProviderBoost(task: TaskCategory, provider: string): number;
|
|
31
|
+
/**
|
|
32
|
+
* Normalize benchmark weights to ensure they sum to 1.0
|
|
33
|
+
*/
|
|
34
|
+
export declare function normalizeBenchmarkWeights(weights: Record<string, number>): Record<string, number>;
|
|
35
|
+
/**
|
|
36
|
+
* Get human-readable description of task requirements
|
|
37
|
+
*/
|
|
38
|
+
export declare function getTaskDescription(task: TaskCategory): string;
|
|
39
|
+
//# sourceMappingURL=taskProfiles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"taskProfiles.d.ts","sourceRoot":"","sources":["../../../nodes/OpenRouterModelSelector/taskProfiles.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEzD;;;;;;;;;GASG;AACH,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,YAAY,EAAE,WAAW,CAmM3D,CAAC;AAEF;;GAEG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,YAAY,GAAG,WAAW,CAE9D;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,YAAY,EAAE,CAElD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,YAAY,EAClB,QAAQ,EAAE,MAAM,GACf,MAAM,CAKR;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC9B,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CASxB;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,YAAY,GAAG,MAAM,CAsB7D"}
|