-
-
Save jamesmurdza/029af469fd89a29962a3d0758ca1590b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { Configuration, OpenAIApi } = require('openai') | |
require('dotenv').config() | |
const configuration = new Configuration({ | |
apiKey: process.env.OPENAI_API_KEY, | |
}) | |
const openai = new OpenAIApi(configuration) | |
openai | |
.createChatCompletion({ | |
model: 'gpt-3.5-turbo', | |
messages: [ | |
{ | |
role: 'user', | |
content: | |
'Write a one-line Haskell function that uses recursion to generate the Fibonacci sequence.', | |
}, | |
], | |
}) | |
.then((completion) => { | |
console.log(completion.data.choices[0].message.content.trim()) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment