Skip to content

Commit

Permalink
Enable LLM result caching and update CLI options to reflect the change
Browse files Browse the repository at this point in the history
  • Loading branch information
pelikhan committed Aug 30, 2024
1 parent 5338c76 commit 32d20d8
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions docs/src/content/docs/reference/cli/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Options:
-mtc, --max-tool-calls <number> maximum tool calls for the run
-se, --seed <number> seed for the run
-em, --embeddings-model <string> embeddings model for the run

Check failure on line 45 in docs/src/content/docs/reference/cli/commands.md

View workflow job for this annotation

GitHub Actions / build

The option "--no-cache" has been changed to "--cache" on line 45. This changes the functionality of the command. Ensure this change is correctly documented.
--no-cache disable LLM result cache
--cache enable LLM result cache
-cn, --cache-name <name> custom cache file name
-cs, --csv-separator <string> csv separator (default: "\t")
-ae, --apply-edits apply file edits
Expand Down Expand Up @@ -87,7 +87,7 @@ Options:
--cli <string> override path to the cli
-tp, --test-provider <string> test provider
-td, --test-delay <string> delay between tests in seconds

Check failure on line 89 in docs/src/content/docs/reference/cli/commands.md

View workflow job for this annotation

GitHub Actions / build

The option "--no-cache" has been changed to "-cache" on line 89. This changes the functionality of the command. Ensure this change is correctly documented.
--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 <file> append output summary in file
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export async function cli() {
"-em, --embeddings-model <string>",
"embeddings model for the run"
)
.option("--no-cache", "disable LLM result cache")
.option("--cache", "enable LLM result cache")

Check failure on line 143 in packages/cli/src/cli.ts

View workflow job for this annotation

GitHub Actions / build

The option "--cache" is missing a prefix. It should be "--no-cache" to maintain consistency with other options.
.option("-cn, --cache-name <name>", "custom cache file name")
.option("-cs, --csv-separator <string>", "csv separator", "\t")
.option("-ae, --apply-edits", "apply file edits")
Expand Down Expand Up @@ -171,7 +171,7 @@ export async function cli() {
.option("--cli <string>", "override path to the cli")
.option("-tp, --test-provider <string>", "test provider")
.option("-td, --test-delay <string>", "delay between tests in seconds")
.option("--no-cache", "disable LLM result cache")
.option("-cache", "enable LLM result cache")

Check failure on line 174 in packages/cli/src/cli.ts

View workflow job for this annotation

GitHub Actions / build

The option "-cache" is missing a prefix. It should be "--no-cache" to maintain consistency with other options.
.option("-v, --verbose", "verbose output")
.option(
"-pv, --promptfoo-version [version]",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Check failure on line 153 in packages/cli/src/test.ts

View workflow job for this annotation

GitHub Actions / build

The condition check for options.cache is incorrect. It should be if (!options.cache) to maintain the original logic.
if (options.verbose) args.push("--verbose")
args.push("--output", outJson)
logVerbose(` ${cmd} ${args.join(" ")}`)
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/genaiscript-api-provider.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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) =>
Expand Down

0 comments on commit 32d20d8

Please sign in to comment.