Hello, I’m trying to parse income response on rest client. I also use stream as well, here is a piece of response:
data: {"object":"chat.completion.chunk","created":1734419156,"model":"gpt-3.5-turbo-0125","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"Hello"},"logprobs":null,"finish_reason":null}],"usage":null}
data: {"object":"chat.completion.chunk","created":1734419156,"model":"gpt-3.5-turbo-0125","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"!"},"logprobs":null,"finish_reason":null}],"usage":null}
For now I clean the data:
text with gsub, and use JSON.parse
. Then I just fill my database with related datas. Does anyone have better flow? (my tech is ruby on rails btw)