Back
Version 3
1/17/2024
import { OpenAI } from "npm:openai";
const openai = new OpenAI();
export const gpt4 = async (content: string, max_tokens: number = 50) => {
let chatCompletion = await openai.chat.completions.create({
messages: [{
role: "user",
content,
}],
model: "gpt-4-1106-preview",
max_tokens: max_tokens,
});
return chatCompletion.choices[0].message.content;
};
Updated: May 14, 2024