-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Include usage in streaming response now possible #55
Comments
oh so sick! Ill get it up asap |
ok I added a small bit of missing defense to handle this error here: c22f0a8#diff-a940976bb69b8ae2a687d8f68c6a81385384c55d244a875e020db391b89c1cbfR65 I tried a few different approaches to see if there was a reasonable way to handle reading usage given a flag in zod-stream - but just because of the nature of what we do in here - it was challenging to find a good way to include in here directly. I have a PR up in instructor that will enable including it - but the approach is just teeing the stream and reading the usage separately so as to not interfere or add any additional work in the JSON parsing flow instructor-ai/instructor-js#176 Thanks for bubbling this up I had no idea they even released it! ps the approach I'm taking in instructor looks like:
|
It would be great to enable this new API feature in zod-stream.
stream_options: {"include_usage": true}
Currently if you include these options in a request will get a
TypeError: Cannot read properties of undefined (reading 'delta')
The text was updated successfully, but these errors were encountered: