This snippet uses machine learning to generate study notes from a given input. Simply provide a topic or question, and the AI will generate comprehensive study notes that cover the most important points. This tool is designed to save time and improve the effectiveness of your study sessions. Give it a try and see how it can help you master any subject!
// 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 {
let content = context.params.event.content.slice(
7,
context.params.event.content.length - 1
);
let a = await lib.openai.playground['@0.0.4'].completions.create({
model: `text-davinci-003`,
prompt: [`Create study notes for : ${content}.`],
max_tokens: 512, //using more tokens so that incomplete response isn't generated
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}`,
});
}