@flotorch/loadtest 0.1.1 → 0.2.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/dist/index.js +15 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -382,7 +382,8 @@ init_esm_shims();
|
|
|
382
382
|
init_esm_shims();
|
|
383
383
|
import { parseArgs } from "util";
|
|
384
384
|
import { readFileSync, writeFileSync, existsSync, mkdirSync } from "fs";
|
|
385
|
-
import { join } from "path";
|
|
385
|
+
import { join, dirname } from "path";
|
|
386
|
+
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
386
387
|
|
|
387
388
|
// src/schemas/config.zod.ts
|
|
388
389
|
init_esm_shims();
|
|
@@ -455,9 +456,11 @@ var cyan = wrap("36", "39");
|
|
|
455
456
|
var magenta = wrap("35", "39");
|
|
456
457
|
|
|
457
458
|
// src/cli/args.ts
|
|
459
|
+
var __dirname2 = dirname(fileURLToPath2(import.meta.url));
|
|
460
|
+
var pkg = JSON.parse(readFileSync(join(__dirname2, "../../package.json"), "utf-8"));
|
|
458
461
|
var VALID_COMMANDS = /* @__PURE__ */ new Set(["run", "generate", "bench", "report", "init"]);
|
|
459
462
|
var HELP_TEXT = `
|
|
460
|
-
${bold("FLOTorch Load Tester")}
|
|
463
|
+
${bold("FLOTorch Load Tester")} ${dim(`v${pkg.version}`)}
|
|
461
464
|
|
|
462
465
|
${yellow("USAGE")}
|
|
463
466
|
flotorch ${dim("<command>")} ${dim("[options]")}
|
|
@@ -480,6 +483,7 @@ ${yellow("OPTIONS")}
|
|
|
480
483
|
${cyan("--base-url")} ${dim("<url>")} Override provider.baseURL
|
|
481
484
|
${cyan("--streaming")} Enable streaming
|
|
482
485
|
${cyan("--no-streaming")} Disable streaming
|
|
486
|
+
${cyan("-v, --version")} Show version number
|
|
483
487
|
${cyan("-h, --help")} Show this help message
|
|
484
488
|
`.trimStart();
|
|
485
489
|
function parseCliArgs(argv) {
|
|
@@ -501,10 +505,15 @@ function parseCliArgs(argv) {
|
|
|
501
505
|
"base-url": { type: "string" },
|
|
502
506
|
streaming: { type: "boolean" },
|
|
503
507
|
"no-streaming": { type: "boolean" },
|
|
508
|
+
version: { type: "boolean", short: "v" },
|
|
504
509
|
help: { type: "boolean", short: "h" }
|
|
505
510
|
},
|
|
506
511
|
allowPositionals: true
|
|
507
512
|
});
|
|
513
|
+
if (values.version) {
|
|
514
|
+
console.log(pkg.version);
|
|
515
|
+
process.exit(0);
|
|
516
|
+
}
|
|
508
517
|
if (values.help) {
|
|
509
518
|
console.log(HELP_TEXT);
|
|
510
519
|
process.exit(0);
|
|
@@ -621,8 +630,8 @@ async function runInit(outputPath) {
|
|
|
621
630
|
}
|
|
622
631
|
let baseURL;
|
|
623
632
|
if (adapter === "openai") {
|
|
624
|
-
const url = await prompt(rl, "Base URL", "https://api.openai.com/v1");
|
|
625
|
-
if (url !== "https://api.openai.com/v1") {
|
|
633
|
+
const url = await prompt(rl, "Base URL", "https://api.openai.com/v1/chat/completions");
|
|
634
|
+
if (url !== "https://api.openai.com/v1/chat/completions") {
|
|
626
635
|
baseURL = url;
|
|
627
636
|
}
|
|
628
637
|
}
|
|
@@ -861,11 +870,11 @@ var OpenAIBackend = class _OpenAIBackend {
|
|
|
861
870
|
apiKey;
|
|
862
871
|
static create(baseURL) {
|
|
863
872
|
const env = validateEnv(EnvSchema, "openai");
|
|
864
|
-
const url = baseURL ?? "https://api.openai.com/v1";
|
|
873
|
+
const url = baseURL ?? "https://api.openai.com/v1/chat/completions";
|
|
865
874
|
return new _OpenAIBackend(url, env.OPENAI_API_KEY);
|
|
866
875
|
}
|
|
867
876
|
constructor(baseURL, apiKey) {
|
|
868
|
-
this.url = baseURL
|
|
877
|
+
this.url = baseURL;
|
|
869
878
|
this.apiKey = apiKey;
|
|
870
879
|
}
|
|
871
880
|
async request(prompt2, model, maxTokens, systemPrompt, params, streaming, signal) {
|