const response = await fetch(CHAT_COMPLETIONS_URL, requestOpts);
const newData of response.body as unknown as NodeJS.ReadableStream
Why the following error:
response.body is not async iterable
The solution I found is the following, but you can operate normally:
The error you encounter is because response.body is not an Async Iterable. In the standard Fetch API, response.body is a ReadableStream, which is not an asynchronous iterable, so you can't use it directly. Let's go through it.
const response = await fetch(CHAT_COMPLETIONS_URL, requestOpts);
const newData of response.body as unknown as NodeJS.ReadableStream
Why the following error:
response.body is not async iterable
The solution I found is the following, but you can operate normally:
The error you encounter is because response.body is not an Async Iterable. In the standard Fetch API, response.body is a ReadableStream, which is not an asynchronous iterable, so you can't use it directly. Let's go through it.