Skip to content

Commit

Permalink
more logging
Browse files Browse the repository at this point in the history
  • Loading branch information
pelikhan committed Apr 29, 2024
1 parent 5800ea0 commit f7f0036
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/cli/src/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
YAMLStringify,
arrayify,
host,
logInfo,
logVerbose,
normalizeFloat,
parseKeyValuePairs,
Expand All @@ -17,6 +18,7 @@ import { writeFile } from "node:fs/promises"
import { execa } from "execa"
import { join } from "node:path"
import { emptyDir, ensureDir } from "fs-extra"
import { log } from "node:console"

function parseModelSpec(m: string): ModelOptions {
const vals = parseKeyValuePairs(m)
Expand Down Expand Up @@ -62,7 +64,7 @@ export async function runTests(
const testProvider =
options?.testProvider || (await resolveTestProvider(scripts[0]))
const models = options?.models
logVerbose(`writing tests to ${out}`)
logInfo(`writing tests to ${out}`)

if (options?.removeOut) await emptyDir(out)
await ensureDir(out)
Expand All @@ -71,15 +73,17 @@ export async function runTests(
const fn = out
? join(out, `${script.id}.promptfoo.yaml`)
: script.filename.replace(/\.genai\.js$/, ".promptfoo.yaml")
logVerbose(` ${fn}`)
logInfo(` ${fn}`)
const config = generatePromptFooConfiguration(script, {
out,
cli,
models: models?.map(parseModelSpec),
provider: "provider.mjs",
testProvider,
})
await writeFile(fn, YAMLStringify(config))
const yaml = YAMLStringify(config)
await writeFile(fn, yaml)
logVerbose(yaml)
}

const outJson = join(out, "res.json")
Expand Down

0 comments on commit f7f0036

Please sign in to comment.