openai-go icon indicating copy to clipboard operation
openai-go copied to clipboard

Set the 'Include Usage' parameter under 'Stream Options' to true in the 'chat-completion-accumulating' example

Open bytesizedwizard opened this issue 1 year ago • 2 comments

Summary

This pull request adds the missingStreamOptions.IncludeUsage option in the example code that should be set to true to retrieve accurate token usage information from the API. Without this parameter, the example currently returns a token usage of 0.

Changes Made

  • Updated the relevant example request options to include the missing parameter with a value of true.

Issue Reference

Fixes #124

Testing

  • Ran the example after adding the parameter and confirmed that token usage is now reported accurately.

Additional Context

This change ensures users get accurate usage data when using the example code.

bytesizedwizard avatar Nov 12 '24 14:11 bytesizedwizard

Thanks, we'll merge this.

jacobzim-stl avatar Nov 18 '24 16:11 jacobzim-stl

Hello @jacobzim-stl, any update on when this would be merged?

bytesizedwizard avatar Dec 13 '24 11:12 bytesizedwizard