@vtstech/pi-model-test 1.0.7 → 1.0.8
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/model-test.js +39 -19
- package/package.json +2 -2
package/model-test.js
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
truncate,
|
|
13
13
|
sanitizeForReport
|
|
14
14
|
} from "@vtstech/pi-shared/format";
|
|
15
|
-
import { getOllamaBaseUrl, detectModelFamily, readModelsJson, BUILTIN_PROVIDERS } from "@vtstech/pi-shared/ollama";
|
|
15
|
+
import { getOllamaBaseUrl, detectModelFamily, readModelsJson, BUILTIN_PROVIDERS, fetchModelContextLength } from "@vtstech/pi-shared/ollama";
|
|
16
16
|
function detectProvider(ctx) {
|
|
17
17
|
const model = ctx.model;
|
|
18
18
|
if (!model) return { kind: "unknown", name: "none" };
|
|
@@ -55,15 +55,15 @@ function detectProvider(ctx) {
|
|
|
55
55
|
}
|
|
56
56
|
var CONFIG = {
|
|
57
57
|
// General API settings
|
|
58
|
-
DEFAULT_TIMEOUT_MS:
|
|
58
|
+
DEFAULT_TIMEOUT_MS: 999999,
|
|
59
59
|
// 8.3 minutes - default timeout for model responses
|
|
60
|
-
CONNECT_TIMEOUT_S:
|
|
60
|
+
CONNECT_TIMEOUT_S: 60,
|
|
61
61
|
// 30 seconds to establish connection
|
|
62
62
|
MAX_RETRIES: 1,
|
|
63
63
|
// Single retry for transient failures
|
|
64
|
-
RETRY_DELAY_MS:
|
|
64
|
+
RETRY_DELAY_MS: 1e4,
|
|
65
65
|
// 2 seconds between retries
|
|
66
|
-
EXEC_BUFFER_MS:
|
|
66
|
+
EXEC_BUFFER_MS: 8e3,
|
|
67
67
|
// Extra buffer for exec timeout over curl timeout
|
|
68
68
|
// Model generation settings
|
|
69
69
|
NUM_PREDICT: 1024,
|
|
@@ -73,28 +73,28 @@ var CONFIG = {
|
|
|
73
73
|
// Test-specific settings
|
|
74
74
|
MIN_THINKING_LENGTH: 10,
|
|
75
75
|
// Minimum chars to consider thinking tokens valid
|
|
76
|
-
TOOL_TEST_TIMEOUT_MS:
|
|
76
|
+
TOOL_TEST_TIMEOUT_MS: 999999,
|
|
77
77
|
// 90 seconds for tool usage tests
|
|
78
|
-
TOOL_TEST_MAX_TIME_S:
|
|
78
|
+
TOOL_TEST_MAX_TIME_S: 999999,
|
|
79
79
|
// Max curl time for tool tests (effectively unlimited)
|
|
80
|
-
TOOL_SUPPORT_TIMEOUT_MS:
|
|
80
|
+
TOOL_SUPPORT_TIMEOUT_MS: 999999,
|
|
81
81
|
// 2+ minutes for tool support detection
|
|
82
|
-
TOOL_SUPPORT_MAX_TIME_S:
|
|
82
|
+
TOOL_SUPPORT_MAX_TIME_S: 999999,
|
|
83
83
|
// Max curl time for tool support detection
|
|
84
84
|
// Metadata retrieval
|
|
85
85
|
TAGS_TIMEOUT_MS: 15e3,
|
|
86
86
|
// 15 seconds for /api/tags
|
|
87
|
-
TAGS_CONNECT_TIMEOUT_S:
|
|
87
|
+
TAGS_CONNECT_TIMEOUT_S: 30,
|
|
88
88
|
// 10 seconds connection timeout for tags
|
|
89
|
-
MODEL_INFO_TIMEOUT_MS:
|
|
89
|
+
MODEL_INFO_TIMEOUT_MS: 3e4,
|
|
90
90
|
// 10 seconds for model info lookup
|
|
91
91
|
// Provider API settings
|
|
92
|
-
PROVIDER_TIMEOUT_MS:
|
|
92
|
+
PROVIDER_TIMEOUT_MS: 999999,
|
|
93
93
|
// 2 minutes for cloud provider API calls
|
|
94
|
-
PROVIDER_TOOL_TIMEOUT_MS:
|
|
94
|
+
PROVIDER_TOOL_TIMEOUT_MS: 12e4,
|
|
95
95
|
// 60 seconds for tool usage tests on providers
|
|
96
96
|
// Rate limiting
|
|
97
|
-
TEST_DELAY_MS:
|
|
97
|
+
TEST_DELAY_MS: 1e4
|
|
98
98
|
// 30 seconds between tests to avoid rate limiting
|
|
99
99
|
};
|
|
100
100
|
var TOOL_SUPPORT_CACHE_DIR = path.join(os.homedir(), ".pi", "agent", "cache");
|
|
@@ -1176,17 +1176,32 @@ The JSON object must have exactly these 4 keys:
|
|
|
1176
1176
|
}
|
|
1177
1177
|
}
|
|
1178
1178
|
const branding = [
|
|
1179
|
-
` \u26A1 Pi Model Benchmark v1.0.
|
|
1179
|
+
` \u26A1 Pi Model Benchmark v1.0.8`,
|
|
1180
1180
|
` Written by VTSTech`,
|
|
1181
1181
|
` GitHub: https://github.com/VTSTech`,
|
|
1182
1182
|
` Website: www.vts-tech.org`
|
|
1183
1183
|
].join("\n");
|
|
1184
|
-
async function testModelOllama(model) {
|
|
1184
|
+
async function testModelOllama(model, providerInfo, ctx) {
|
|
1185
1185
|
const lines = [];
|
|
1186
1186
|
const totalStart = Date.now();
|
|
1187
1187
|
lines.push(branding);
|
|
1188
1188
|
lines.push(section(`MODEL: ${model}`));
|
|
1189
1189
|
lines.push(info("Provider: Ollama (local/remote)"));
|
|
1190
|
+
const modelsJson = readModelsJson();
|
|
1191
|
+
let apiMode = "ollama";
|
|
1192
|
+
const providerName = ctx?.model?.provider || providerInfo?.name || "";
|
|
1193
|
+
if (providerName && modelsJson) {
|
|
1194
|
+
const providerCfg = (modelsJson.providers || {})[providerName];
|
|
1195
|
+
if (providerCfg) {
|
|
1196
|
+
apiMode = providerCfg.api || "ollama";
|
|
1197
|
+
}
|
|
1198
|
+
}
|
|
1199
|
+
lines.push(info(`API: ${apiMode}`));
|
|
1200
|
+
const nativeContext = await fetchModelContextLength(OLLAMA_BASE, model);
|
|
1201
|
+
if (nativeContext !== void 0) {
|
|
1202
|
+
const ctxStr = nativeContext >= 1e3 ? `${(nativeContext / 1e3).toFixed(1)}k` : String(nativeContext);
|
|
1203
|
+
lines.push(info(`Context: ${ctxStr} tokens (native max)`));
|
|
1204
|
+
}
|
|
1190
1205
|
let modelSize = "unknown";
|
|
1191
1206
|
let modelFamily = "unknown";
|
|
1192
1207
|
let modelParams = "unknown";
|
|
@@ -1387,7 +1402,7 @@ The JSON object must have exactly these 4 keys:
|
|
|
1387
1402
|
}
|
|
1388
1403
|
return lines.join("\n");
|
|
1389
1404
|
}
|
|
1390
|
-
async function testModelProvider(providerInfo, model) {
|
|
1405
|
+
async function testModelProvider(providerInfo, model, ctx) {
|
|
1391
1406
|
const lines = [];
|
|
1392
1407
|
const totalStart = Date.now();
|
|
1393
1408
|
lines.push(branding);
|
|
@@ -1400,6 +1415,11 @@ The JSON object must have exactly these 4 keys:
|
|
|
1400
1415
|
} else {
|
|
1401
1416
|
lines.push(warn(`API Key: NOT SET (${providerInfo.envKey || "env var not found"})`));
|
|
1402
1417
|
}
|
|
1418
|
+
const contextWindow = ctx?.model?.contextWindow ?? null;
|
|
1419
|
+
if (contextWindow !== null) {
|
|
1420
|
+
const ctxStr = contextWindow >= 1e3 ? `${(contextWindow / 1e3).toFixed(1)}k` : String(contextWindow);
|
|
1421
|
+
lines.push(info(`Context: ${ctxStr} tokens`));
|
|
1422
|
+
}
|
|
1403
1423
|
lines.push(section("CONNECTIVITY TEST"));
|
|
1404
1424
|
lines.push(info("Sending minimal request to verify API reachability and key validity..."));
|
|
1405
1425
|
const connectivity = await testConnectivity(providerInfo, model);
|
|
@@ -1520,9 +1540,9 @@ The JSON object must have exactly these 4 keys:
|
|
|
1520
1540
|
async function testModel(model, ctx) {
|
|
1521
1541
|
const providerInfo = ctx ? detectProvider(ctx) : { kind: "ollama", name: "ollama" };
|
|
1522
1542
|
if (providerInfo.kind === "ollama") {
|
|
1523
|
-
return testModelOllama(model);
|
|
1543
|
+
return testModelOllama(model, providerInfo, ctx);
|
|
1524
1544
|
} else if (providerInfo.kind === "builtin") {
|
|
1525
|
-
return testModelProvider(providerInfo, model);
|
|
1545
|
+
return testModelProvider(providerInfo, model, ctx);
|
|
1526
1546
|
} else {
|
|
1527
1547
|
return testModelOllama(model);
|
|
1528
1548
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vtstech/pi-model-test",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "Model benchmark/testing extension for Pi Coding Agent",
|
|
5
5
|
"main": "model-test.js",
|
|
6
6
|
"keywords": ["pi-extensions"],
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"url": "https://github.com/VTSTech/pi-coding-agent"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@vtstech/pi-shared": "1.0.
|
|
17
|
+
"@vtstech/pi-shared": "1.0.8"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
20
|
"@mariozechner/pi-coding-agent": ">=0.66"
|