This simple code snippet uses OpenAI's GPT models to automatically generate a structured outline for your research topic. Just input your topic, and let the AI do the work. Saves you time and helps you organize your research ideas efficiently.
// authenticates you with the API standard library
// type `await lib.` to display API autocomplete
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
try {
// removing the prefix
let b = context.params.event.content.slice(
9,
context.params.event.content.length - 1
);
let a = await lib.openai.playground['@0.0.4'].completions.create({
model: `text-davinci-003`,
prompt: [`Create outline for research on : ${b}.`],
max_tokens: 512,
temperature: 0.3,
top_p: 1,
n: 1,
echo: false,
presence_penalty: 0,
frequency_penalty: 0,
});
await lib.discord.channels['@0.3.4'].messages.create({
channel_id: `${context.params.event.channel_id}`,
content: `${a.choices[0].text}`,
});
} catch (e) {
await lib.discord.channels['@0.3.4'].messages.create({
channel_id: `${context.params.event.channel_id}`,
content: `${e}`,
});
}
/*
An example:
!outline JEE Mains
*/