| 1394 | // ============================================================================ |
| 1395 | |
| 1396 | function printUsage(): void { |
| 1397 | console.log(` |
| 1398 | ${COLORS.bright}LLM Parameter Sweep Tool${COLORS.reset} |
| 1399 | |
| 1400 | Tests which parameter values are accepted by LLM vendor APIs. |
| 1401 | |
| 1402 | ${COLORS.bright}Usage:${COLORS.reset} |
| 1403 | sweep.ts --config <path> Use JSON config file |
| 1404 | sweep.ts --dialect <name> --key <key> Test a single vendor |
| 1405 | |
| 1406 | ${COLORS.bright}Options:${COLORS.reset} |
| 1407 | --config <path> JSON config file (SweepConfig or Record<string, AixAPI_Access>) |
| 1408 | --dialect <name> Vendor dialect (openai, anthropic, gemini, xai, openrouter, ...) |
| 1409 | --key <key> API key for single vendor |
| 1410 | --host <url> Custom host for single vendor |
| 1411 | --model-filter <re> Regex to filter model IDs |
| 1412 | --sweep-filter <csv> Comma-separated sweep names to run |
| 1413 | --delay <ms> Delay between sweeps (default: 1000). In --sequential mode, delay between values. |
| 1414 | --max-models <n> Max models to test per vendor (default: 100) |
| 1415 | --sequential Run value tests sequentially (default: parallel) |
| 1416 | --merge-models Merge new models into existing JSON file (default: overwrite) |
| 1417 | --verbose Show detailed log messages below each sweep line |
| 1418 | --debug Print request body before each probe |
| 1419 | --include-symlinks Include symlink models (excluded by default) |
| 1420 | --dry-run Print what would be tested without sending requests |
| 1421 | --help Show this help |
| 1422 | |
| 1423 | ${COLORS.bright}Config file format (SweepConfig):${COLORS.reset} |
| 1424 | { |
| 1425 | "delayMs": 1000, |
| 1426 | "maxTokens": 128, |
| 1427 | "vendors": { |
| 1428 | "openai": { |
| 1429 | "access": { "dialect": "openai", "oaiKey": "sk-...", "oaiOrg": "", "oaiHost": "", "heliKey": "" }, |
| 1430 | "sweeps": ["temperature", "oai-reasoning-effort", "oai-verbosity"], |
| 1431 | "modelFilter": "gpt-4o", |
| 1432 | "baseModelOverrides": {} |
| 1433 | } |
| 1434 | } |
| 1435 | } |
| 1436 | |
| 1437 | Sweeps are referenced by name from the built-in definitions (see below). |
| 1438 | If "sweeps" is omitted, all applicable sweeps for the dialect are run. |
| 1439 | |
| 1440 | ${COLORS.bright}Available built-in sweeps:${COLORS.reset} |
| 1441 | ${SWEEP_DEFINITIONS.map(s => { |
| 1442 | const dialects = s.applicability.type === 'all' |
| 1443 | ? `${COLORS.green}all${COLORS.reset}` |
| 1444 | : s.applicability.dialects.map(d => `${COLORS.magenta}${d}${COLORS.reset}`).join(', '); |
| 1445 | return ` ${COLORS.cyan}${s.name.padEnd(26)}${COLORS.reset} ${s.description} [${dialects}]`; |
| 1446 | }).join('\n')} |
| 1447 | |
| 1448 | ${COLORS.bright}Available tool probes:${COLORS.reset} |
| 1449 | ${TOOL_PROBE_DEFINITIONS.map(p => { |
| 1450 | const dialects = p.applicability.type === 'all' |
| 1451 | ? `${COLORS.green}all${COLORS.reset}` |
| 1452 | : p.applicability.dialects.map(d => `${COLORS.magenta}${d}${COLORS.reset}`).join(', '); |
| 1453 | return ` ${COLORS.cyan}${p.name.padEnd(26)}${COLORS.reset} ${p.description} [${dialects}]`; |