Expose Parser and add OpenAI example in usage guide#2
Merged
Conversation
Owner
|
Hey @martosaur, appreciate the PR! I will happily add this ability back. However, I have some implementation preferences that differ from what is here.
|
Contributor
Author
|
@benjreinhart of course! Just pushed the changes |
benjreinhart
left a comment
Owner
There was a problem hiding this comment.
You know, i'm so sorry, but I was wrong. It doesn't make sense to me to expose a new() function to construct a struct from another module. I think your first pass here makes sense.
Sorry to thrash, but I think moving back to exposing the parser module and using that to do the lower-level parsing is the right approach.
Thanks
6e028c7 to
b6395a3
Compare
Contributor
Author
|
Haha it's all good, I left initial commit intact just in case. Please check now! |
| @moduledoc """ | ||
| Low level SSE parser. | ||
|
|
||
| @type event :: %{ |
Owner
There was a problem hiding this comment.
Was this intentional? I think we can leave this here?
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Hi @benjreinhart and thank you for the library, it's amazing!
I kind of miss version 0.2.0 manual parsing, since it allowed me to use Req's callback streaming and, most importantly, make Req eventually return whole response body once the stream is complete. This is useful, for example, if any response steps expect a full body. One example is PostHog's LLMAnalytics Req plugin.
This PR just adds
Parser.init/0function, makesparse/0andparse/1public and adds an example in usage guide.