Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
559 B
1
Indexable
Never
const { Configuration, OpenAIApi } = require("openai");

const configuration = new Configuration({
  apiKey: process.env.OPENAI_API_KEY,
});
const openai = new OpenAIApi(configuration);

const response = await openai.createCompletion({
  model: "text-davinci-002",
  prompt: "read the following news and summarize it for a 280 characters tweet with hashtag:\n\nNews Title:  {NEWS TITLE HERE}\n\nNews content:  {NEWS CONTENT HERE}\n\nTweet: \n",
  temperature: 0,
  max_tokens: 300,
  top_p: 1,
  frequency_penalty: 0,
  presence_penalty: 0,
});