-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
openai[minor]: OpenAI - Ability to set stream_options and streamUsage when instantiating ChatOpenAI class. #5761
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hey, thanks for taking initiative on this! We're actually implementing a new streamUsage
constructor arg & call option, but haven't gotten around to implementing it for OpenAI yet. If you wanted to implement it, here's a PR you can copy from. If not, feel free to close this PR.
Please ping me if you have any questions on it!
Actually, lets include both |
@bracesproul, I think I've made the changes you are after. |
Getting a few 400s when running integration tests:
Seems like we may need to be a bit more selective on how we populate this? |
Is it possible to run the integration tests outside of being kicked off by a maintainer? To address the 400 for stream: false when requesting usage data I've updated so that either stream_options: {include_usage:true}/ streamUsage true will force the stream flag to be set to true, and if not fallback to this.streaming. To make it BC I've altered streamUsage to default to false. It may make more sense to just throw the error back the user of the library, stating that you can't request stream usage info with the stream flag set to false? Let me know if there's any other changes you'd like to see before its ready to merge Thanks |
Changed to default to true, avoid passing as an invocation param if |
Thank you! |
Fixes 965 - Where its not possible to get the usage back from OpenAI when streaming and using chains or agents.