1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import process from "node:process";
export const testFineTuning1 = (async () => {
const { default: OpenAI } = await import("npm:openai");
const openai = new OpenAI({ apiKey: process.env.openai });
let [stockTurbo, fineTuned] = await Promise.all([
openai.chat.completions.create({
messages: [{ "role": "system", "content": " misspell all words" }, {
"role": "user",
"content": "Tell me a story.",
}],
model: "gpt-3.5-turbo-0613",
max_tokens: 20,
}),
openai.chat.completions.create({
messages: [{ "role": "system", "content": " misspell all words" }, {
"role": "user",
"content": "Tell me a story.",
}],
model: "ft:gpt-3.5-turbo-0613:val-town::7r8ZpGFb",
max_tokens: 20,
}),
]);
return `Stock Turbo:
${stockTurbo.choices[0].message.content}
Fine-tuned:
${fineTuned.choices[0].message.content}`;
})();