Skip to content

Quickest way to calculate token usage with streaming responses #7198

Closed Answered by madsbolaris
pshekhar-esri asked this question in Q&A
Discussion options

You must be logged in to vote

I'm assuming you're using Azure OpenAI. There's currently an open task on the Azure OpenAI SDK to add token information to the response payload for streaming since it currently doesn't exist. The best alternative is what you described (using a package like TikToken). It is, however, a bit difficult to get completely accurate answers though because it's difficult to tokenize the function information provided to the model.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@KurtP20
Comment options

Answer selected by sophialagerkranspandey
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants