Skip to content

Commit

Permalink
Merge pull request #506 from T-Damer/patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
transitive-bullshit committed Mar 29, 2023
2 parents 4613b95 + cf29a97 commit 0984504
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion readme.md
Expand Up @@ -280,8 +280,11 @@ Note that we automatically handle appending the previous messages to the prompt

```js
async function example() {
// To use ESM in CommonJS, you can use a dynamic import
// To use ESM in CommonJS, you can use a dynamic import like this:
const { ChatGPTAPI } = await import('chatgpt')
// You can also try dynamic importing like this:
// const importDynamic = new Function('modulePath', 'return import(modulePath)')
// const { ChatGPTAPI } = await importDynamic('chatgpt')

const api = new ChatGPTAPI({ apiKey: process.env.OPENAI_API_KEY })

Expand Down

0 comments on commit 0984504

Please sign in to comment.