-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9f37dd1
commit f50773e
Showing
3 changed files
with
42 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { openai } from "@ai-sdk/openai"; | ||
import { generateText } from "ai"; | ||
import { evalite, Levenshtein } from "evalite-vitest"; | ||
|
||
evalite("Test basics", { | ||
data: async () => [ | ||
{ | ||
input: `What's the capital of France?`, | ||
expected: `Lille.`, | ||
}, | ||
{ | ||
input: `What's the capital of Germany?`, | ||
expected: `Berlin.`, | ||
}, | ||
{ | ||
input: `What's the capital of Italy?`, | ||
expected: `Rome.`, | ||
}, | ||
{ | ||
input: `What's the capital of the United States?`, | ||
expected: `Washington, D.C.`, | ||
}, | ||
], | ||
task: async (input) => { | ||
const result = await generateText({ | ||
model: openai("gpt-3.5-turbo"), | ||
system: ` | ||
Answer the question concisely, in as few words as possible. | ||
`, | ||
prompt: input, | ||
}); | ||
|
||
return result.text; | ||
}, | ||
scorers: [Levenshtein], | ||
}); |
This file was deleted.
Oops, something went wrong.