Skip to content

Instantly share code, notes, and snippets.

@davila7
Created December 4, 2022 23:18
Show Gist options
  • Select an option

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

Select an option

Save davila7/9662f560a01f3d12b60c9b49bf4b53b1 to your computer and use it in GitHub Desktop.
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: "code-davinci-002",
prompt: "Can you print 'Hello World' in Javascript?",
temperature: 0,
max_tokens: 60,
top_p: 1.0,
frequency_penalty: 0.5,
presence_penalty: 0.0,
stop: ["."],
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment