transitive-bullshit / openai-partial-json-parser

Partial JSON parser extracted from OpenAI's vendored version.
MIT License
13 stars 0 forks source link

Nice work! #1

Closed jonschlinkert closed 1 week ago

jonschlinkert commented 2 months ago

Just creating an issue because I created something very similar a couple of weeks ago and haven't published it yet, and I just noticed that you created this repo, so I created this gist instead: https://gist.github.com/jonschlinkert/b5cc36ccb10a422c7dca0c0be4272ac0

I generalized mine for more than OpenAI's json, but even if yours is close enough to what I need I don't want to create a duplicate lib if there isn't a good reason. Anyway, feel free to close this. I figured I'd link to my code in case there is anything useful in it, or even if you just want to use the unit test approach or something.

Edit: Oh I see, these are actually doing something pretty different. Mine returns an AST that can be used to generate the JSON object or print to a string. Still, yours will probably work for what I need. Sorry for the run on comment lol.

transitive-bullshit commented 2 months ago

Thanks, Jon 😄

Really like your approach to the unit tests, so I ported over your fixtures and added them to the latest release: https://github.com/transitive-bullshit/openai-partial-json-parser/commit/d42114189d1631186746ef988834569af29307dd