How do i parse the stream return when using the old openai.createChatCompletion api?

    chatSSE202309(messages) {
        return openai.createChatCompletion({
            model: "gpt-3.5-turbo",
            messages,
            max_tokens: 2048,
            temperature: 0.9,
            stream: true
        }, Object.assign({ responseType: 'stream' }, axiosConfig));
    }

                                // console.log('chat', chat, 'message', message);
                                res = await GPTService.chatSSE202309(message);
                                if (!res) {
                                    res = await GPTService.chatSSE202309Code(message);
                                }

                        res.data.on('data', (data) => {

                        })

the res.data.on(‘data’,data=>{}) in this ,how to I parse it ???

before you start . I cant just upgrade the api to 4.0.0 whenever i want ,im using 3.2.1 version. plase tell me how to parse this .

Hi,

You might take a look at this post

my friend you missunderstood, i have no problem in getting the data ,my only problem is with the parse of the data .
i dont know how to parse it with 0 error.

if you are not a openai’s ai employee you might can see that i have already got the data. from the on(‘data’,data=>{})event callback method that you just mentioned.

my friend you missunderstood, i have no problem in getting the data ,my only problem is with the parse of the data .
i dont know how to parse it with 0 error.

You might take a look here