ai-speedometer 1.3.3 → 1.3.5
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/cli.js +27 -9
- package/dist/ai-speedometer +79 -79
- package/package.json +1 -2
package/cli.js
CHANGED
|
@@ -2174,8 +2174,23 @@ process.on('SIGINT', () => {
|
|
|
2174
2174
|
// Headless benchmark mode
|
|
2175
2175
|
async function runHeadlessBenchmark(benchSpec, apiKey, useAiSdk) {
|
|
2176
2176
|
try {
|
|
2177
|
-
// Parse provider:model format
|
|
2178
|
-
|
|
2177
|
+
// Parse provider:model format, handling quoted model IDs
|
|
2178
|
+
let providerSpec, modelName;
|
|
2179
|
+
const colonIndex = benchSpec.indexOf(':');
|
|
2180
|
+
if (colonIndex === -1) {
|
|
2181
|
+
console.error(colorText('Error: Invalid --bench format. Use: provider:model', 'red'));
|
|
2182
|
+
console.error(colorText('Example: --bench zai-code-anth:glm-4.6', 'yellow'));
|
|
2183
|
+
process.exit(1);
|
|
2184
|
+
}
|
|
2185
|
+
|
|
2186
|
+
providerSpec = benchSpec.substring(0, colonIndex);
|
|
2187
|
+
modelName = benchSpec.substring(colonIndex + 1);
|
|
2188
|
+
|
|
2189
|
+
// Remove quotes from model name if present
|
|
2190
|
+
if ((modelName.startsWith('"') && modelName.endsWith('"')) ||
|
|
2191
|
+
(modelName.startsWith("'") && modelName.endsWith("'"))) {
|
|
2192
|
+
modelName = modelName.slice(1, -1);
|
|
2193
|
+
}
|
|
2179
2194
|
|
|
2180
2195
|
if (!providerSpec || !modelName) {
|
|
2181
2196
|
console.error(colorText('Error: Invalid --bench format. Use: provider:model', 'red'));
|
|
@@ -2202,19 +2217,22 @@ async function runHeadlessBenchmark(benchSpec, apiKey, useAiSdk) {
|
|
|
2202
2217
|
}
|
|
2203
2218
|
|
|
2204
2219
|
// Find the model
|
|
2205
|
-
//
|
|
2206
|
-
//
|
|
2207
|
-
// 1. Full ID match: "zai-code-anth_glm-4.6"
|
|
2208
|
-
// 2. ID without provider prefix: "glm-4.6"
|
|
2209
|
-
// 3. Name match: "GLM-4.6-anth"
|
|
2220
|
+
// First try exact match with the provided model ID
|
|
2221
|
+
// Then fall back to legacy matching for compatibility
|
|
2210
2222
|
const model = provider.models.find(m => {
|
|
2211
2223
|
const modelIdLower = m.id?.toLowerCase() || '';
|
|
2212
2224
|
const modelNameLower = m.name?.toLowerCase() || '';
|
|
2213
2225
|
const searchLower = modelName.toLowerCase();
|
|
2214
2226
|
|
|
2215
|
-
//
|
|
2227
|
+
// Exact ID match first (for quoted model IDs like "hf:moonshotai/Kimi-K2-Instruct-0905")
|
|
2216
2228
|
if (modelIdLower === searchLower) return true;
|
|
2217
2229
|
|
|
2230
|
+
// Legacy matching for backward compatibility:
|
|
2231
|
+
// Model IDs are prefixed with provider name (e.g., "zai-code-anth_glm-4.6")
|
|
2232
|
+
// So we need to check:
|
|
2233
|
+
// 1. ID without provider prefix: "glm-4.6"
|
|
2234
|
+
// 2. Name match: "GLM-4.6-anth"
|
|
2235
|
+
|
|
2218
2236
|
// Check ID without provider prefix (strip "provider_" prefix)
|
|
2219
2237
|
const idWithoutPrefix = modelIdLower.includes('_')
|
|
2220
2238
|
? modelIdLower.split('_').slice(1).join('_')
|
|
@@ -2305,7 +2323,7 @@ async function runHeadlessBenchmark(benchSpec, apiKey, useAiSdk) {
|
|
|
2305
2323
|
}
|
|
2306
2324
|
|
|
2307
2325
|
// Start the CLI
|
|
2308
|
-
if (
|
|
2326
|
+
if (require.main === module) {
|
|
2309
2327
|
// Check if help flag
|
|
2310
2328
|
if (cliArgs.help) {
|
|
2311
2329
|
showHelp();
|