This repository contains a reusable function leveraging async generators to stream real-time responses from OpenAI's ChatGPT API, word by word, in a Node.js environment. Instead of waiting for the entire response to be generated, this function allows for an interactive experience where the AI's thoughts are streamed as they are produced.
- Node.js 18.14 or higher (since we're using nodejs native fetch)
- A valid API key for OpenAI's ChatGPT