From 32d20d8b8ca53ef7f838e35aaa9e628a46346f1b Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Fri, 30 Aug 2024 01:56:58 +0000 Subject: [PATCH] Enable LLM result caching and update CLI options to reflect the change --- docs/src/content/docs/reference/cli/commands.md | 4 ++-- packages/cli/src/cli.ts | 4 ++-- packages/cli/src/test.ts | 2 +- packages/core/src/genaiscript-api-provider.mjs | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/src/content/docs/reference/cli/commands.md b/docs/src/content/docs/reference/cli/commands.md index 0d81344db2..28486fe5ea 100644 --- a/docs/src/content/docs/reference/cli/commands.md +++ b/docs/src/content/docs/reference/cli/commands.md @@ -43,7 +43,7 @@ Options: -mtc, --max-tool-calls maximum tool calls for the run -se, --seed seed for the run -em, --embeddings-model embeddings model for the run - --no-cache disable LLM result cache + --cache enable LLM result cache -cn, --cache-name custom cache file name -cs, --csv-separator csv separator (default: "\t") -ae, --apply-edits apply file edits @@ -87,7 +87,7 @@ Options: --cli override path to the cli -tp, --test-provider test provider -td, --test-delay delay between tests in seconds - --no-cache disable LLM result cache + -cache enable LLM result cache -v, --verbose verbose output -pv, --promptfoo-version [version] promptfoo version, default is 0.78.0 -os, --out-summary append output summary in file diff --git a/packages/cli/src/cli.ts b/packages/cli/src/cli.ts index 1bbbd9057b..55a0ec302f 100644 --- a/packages/cli/src/cli.ts +++ b/packages/cli/src/cli.ts @@ -140,7 +140,7 @@ export async function cli() { "-em, --embeddings-model ", "embeddings model for the run" ) - .option("--no-cache", "disable LLM result cache") + .option("--cache", "enable LLM result cache") .option("-cn, --cache-name ", "custom cache file name") .option("-cs, --csv-separator ", "csv separator", "\t") .option("-ae, --apply-edits", "apply file edits") @@ -171,7 +171,7 @@ export async function cli() { .option("--cli ", "override path to the cli") .option("-tp, --test-provider ", "test provider") .option("-td, --test-delay ", "delay between tests in seconds") - .option("--no-cache", "disable LLM result cache") + .option("-cache", "enable LLM result cache") .option("-v, --verbose", "verbose output") .option( "-pv, --promptfoo-version [version]", diff --git a/packages/cli/src/test.ts b/packages/cli/src/test.ts index b5d1ecce9a..818e42b28a 100644 --- a/packages/cli/src/test.ts +++ b/packages/cli/src/test.ts @@ -150,7 +150,7 @@ export async function runPromptScriptTests( "1", "--no-progress-bar", ] - if (!options.cache) args.push("--no-cache") + if (options.cache) args.push("--cache") if (options.verbose) args.push("--verbose") args.push("--output", outJson) logVerbose(` ${cmd} ${args.join(" ")}`) diff --git a/packages/core/src/genaiscript-api-provider.mjs b/packages/core/src/genaiscript-api-provider.mjs index 805489b17d..76040f1be0 100644 --- a/packages/core/src/genaiscript-api-provider.mjs +++ b/packages/core/src/genaiscript-api-provider.mjs @@ -54,7 +54,7 @@ class GenAIScriptApiProvider { if (temperature !== undefined) args.push("--temperature", temperature) if (top_p !== undefined) args.push("--top_p", top_p) - if (cache === false) args.push("--no-cache") + if (cache === true) args.push("--cache") const cmd = args .map((a) =>