I just finished prototyping a project that uses the ChatGPT API, and I used its function call feature to streamline my code. However, I didn't find much online about how to use this feature with the NodeJS openai library, so I thought I'd do a write up on that here.

The function call feature allows you to describe a function to ChatGPT, and get a JSON string in return with arguments which you can then use to call that function. Note that ChatGPT will not actually call the function itself as part of this API - instead it returns JSON which you need to then parse, validate, and then use to call the function yourself later in your code.

... Read more