You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We may also want to consider updating the generator to just return total cost separate from the response chunk so the generator would have type Generator[BaseCallResponseChunkT, None, Optional[float]] and then return total cost at the end of the generator if available, otherwise return None.
Is your feature request related to a problem? Please describe.
Prior versions of openai did not have usage stats when streaming.
Describe the solution you'd like
Add
stream_options: {"include_usage": true}
. Addtotal_cost
as a property ofOpenAICallResponseChunk
.Additional context
OpenAI Cookbook Reference
The text was updated successfully, but these errors were encountered: