Public
Back
Version 17
8/3/2024
import { OpenAI } from "npm:openai";
const apiKey = Deno.env.get("OPENAI_API_KEY");
const openai = new OpenAI({ apiKey });
const create = openai.chat.completions.create;
const cfg = {
model: "gpt-4o-mini",
max_tokens: 30,
};
const prompt = async (msg: string) => await create({ ...cfg, messages: [{ role: "user", content: msg }] });
const baseMsg = (extraInfo = "") => `
Please generate me a list of 50 unique, memorable strings that I
could use as simple passwords or for unique IDs. Please use a mix
of funny words and numbers, but the entries should not be more than
12 characters in length. ${extraInfo}
Please separate the values into a marked block
so that I can easily parse them.
`;
const opts = {
slug: "These values will need to work as slug values, so dont incldue special characters.",
password: "These values will be used as passwords, so make sure they satisfy reasonable password requirements.",
} as const;
async function generate(opt: keyof typeof opts) {
const msg = baseMsg(opt);
const results = await prompt(msg);
console.log(results);
return results;
}
dfb-funidorpassword.web.val.run
Updated: August 12, 2024