admin管理员组文章数量:1434914
I am using openAI Assistant, I get the streamingUpdate using
streamingUpdate = assistantClient.CreateRunStreaming(thread, assistant);
I could iterate through streamingUpdate and send the response to the client using SignalR api. however I would like to know how to count the #of tokens consumed in the streaming mode.
I am using openAI Assistant, I get the streamingUpdate using
streamingUpdate = assistantClient.CreateRunStreaming(thread, assistant);
I could iterate through streamingUpdate and send the response to the client using SignalR api. however I would like to know how to count the #of tokens consumed in the streaming mode.
Share Improve this question edited Jan 8 at 19:39 General Grievance 5,04338 gold badges37 silver badges56 bronze badges asked Nov 18, 2024 at 10:14 Sankaranarayanan RajkumarSankaranarayanan Rajkumar 511 silver badge7 bronze badges1 Answer
Reset to default 1I found the way to get the token count
CompletionTokens = assistantClient.GetRuns(threadID).Select(f => f.Usage.CompletionTokens).SingleOrDefault();
PromptTokens = assistantClient.GetRuns(threadID).Select(f => f.Usage.PromptTokens).SingleOrDefault();
TotalTokens = assistantClient.GetRuns(threadID).Select(f => f.Usage.TotalTokens).SingleOrDefault();
本文标签: cHow to countof tokens consumed by OpenAI Assistant while streaming the messageStack Overflow
版权声明:本文标题:c# - How to count # of tokens consumed by OpenAI Assistant while streaming the message - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745626873a2667025.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论