Show HN: GJP-4-GPT, a Gradual JSON Parser for GPT's (github.com)

3 points by explaininjs ↗ HN
Often it's easiest to have an LLM output the results you need in JSON form, but streaming those outputs into an actual viewport is nontrivial. Thus I made this package, a streaming JSON parser that handles all the work of decoding your JSON so you can focus on displaying your UIs.

1 comment

[ 3.2 ms ] story [ 14.3 ms ] thread
I also provide utilities for dealing with OpenAI-style HTTP response streams, never worry about splitting out the `data:` prefix and JSON parsing the rest, but making sure to include the last chunk if that was incomplete, but also looking out for errors, etc. etc. etc..... again!