Skip to content

Instantly share code, notes, and snippets.

@davila7
Created December 15, 2022 20:03
Show Gist options
  • Select an option

  • Save davila7/f62141782b39a594c193addbfeb09b57 to your computer and use it in GitHub Desktop.

Select an option

Save davila7/f62141782b39a594c193addbfeb09b57 to your computer and use it in GitHub Desktop.
const one_shot_text = 'Bot: Ask me any question. '+
'Me: Can I ask you something about programming?. '+
'Bot: Yes, of course. Tell me your question and I will answer it. '+
'Me: My question about Javascript is: Write a JavaScript function to apply Bubble Sort algorithm.'+
'Bot:';
async function main() {
const completion = await openai.createCompletion({
model: "text-davinci-003",
prompt: one_shot_text,
temperature: 0,
max_tokens: 250,
top_p: 1.0,
frequency_penalty: 0.5,
presence_penalty: 0.0,
stop: ["Bot:", 'Me:'],
});
console.log(completion.data.choices[0].text)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment