async function generateRawText(prompt) {
console.log("Loading model...");
// We use a base model (GPT-2) which lacks alignment/safeguards
const generator = await pipeline('text-generation', 'Xenova/gpt2');
console.log("Generating response...");
// The model generates text strictly based on the prompt's probability distribution
const output = await generator(prompt, {
max_new_tokens: 50,
temperature: 0.7, // Adjusts randomness (higher = more creative/chaotic)
top_k: 50, // Limits vocabulary choices to the top 50 most likely tokens
repetition_penalty: 1.2
});
return output[0].generated_text;
}
// Example usage
const userPrompt = "The most dangerous piece of technology is";