Closed steve8708 closed 1 year ago
how this can be done:
const res = await openai.createChatCompletion({
messages: [{ content: prompt }],
stream: true,
}, { responseType: "stream" });
now the response will be a text stream. we could stream the response to the CLI output with process.stdout.write
more context/examples: https://twitter.com/Steve8708/status/1644377554034503680
Instead of making the user wait for the entire output of the shell code or description to be finished to see it, it would be great to stream the response word by word to the terminal like done on sites like chatgpt