Just checking, anyone done anything with streamed ...
# cfml-general
d
Just checking, anyone done anything with streamed HTTP responses? I'm looking to do some work with the OpenAI APIs and wanted to see if using their "streamed" responses provide a better UI experience. The "stream" response sends chunks of JSON via a streamed HTTP request, so I'd need to be able to process the incoming HTTP response as the request is coming in. I did some searching and didn't see any examples of people doing this with ACF/Lucee (we're on Lucee). I'm sure I can use native Java to do it, but just wondering if there's any existing OS projects that address handling streamed HTTP responses.
j
This is an old post and I have not tested it out myself but may be worth looking into. https://cflove.org/2013/12/get-large-files-over-http-in-coldfusion.cfm
I was curious so I got couple of examples working to stream CSV files over http. Not sure how it would work with the OpenAI api. Just briefly looking at the docs its seems that the tricky part may be figuring out how to parse the data as it comes in. https://gist.github.com/jsteinshouer/6a83764a16f0f18290e4b73d4b64b6c1