Hey, how can I connect botpress bot to openai api ? I want to use gpt4 but i need to have payment history on gpt 3 so i want to connect it first
here's my code in execute code card:
const { Configuration, OpenAIApi } = require('openai')
const configuration = new Configuration({
apiKey: 'env.openaiapikey'
})
const openai = new OpenAIApi(configuration)
const completion = await openai.createChatCompletion({
model: 'gpt-3.5-turbo',
messages: [
{ role: 'system', content: 'You are a helpful assistant.' },
{ role: 'user', content: 'Hello world' }
]
})
console.log(completion.data.choices[0].message)