agentic
agentic copied to clipboard
How to get the usage of "CompletionResponseUsage" returned by OpenAI API?
Describe the feature
like prompt_tokens、completion_tokens and total_tokens
At present, I can only get these parameters:
{ role: 'assistant', id: 'cmpl-6hu42pXvZhCYuEmifKobRHYrJfOu6', parentMessageId: '504ce20d-ac0f-4cf8-83dc-013cb4fb172f', conversationId: '6c868ac8-465c-42cc-96d7-deef6b4a54d5', text: 'hi!' }
I think this is a good idea; we should add this extra metadata to a detail
attribute on the returned json.
@HttpStatusOK responses now include a detail
property which includes the full OpenAI response, so you should have access to the usage info. Upgrade to latest to see the change.
@HttpStatusOKresponses 现在包含一个
detail
包含完整 OpenAI 响应的属性,因此您应该可以访问使用信息。升级到最新版本以查看更改。
您好 ,我升级到5.0.10。还是没有发现 prompt_tokens、completion_tokens total_tokens 这三个参数.
我在非stream的模式下看到了这三个参数,但是我想在stream的时候也能得到这三个参数 请问我应该如何做
@MyJacking Does the detail
property of the result object not contain this info for you in stream
mode?
Can you include a code example of how you're calling sendMessage
?
@transitive-bullshit stream
mode currently does not include prompt_tokens, completion_tokens, and total_tokens. Would it be possible to add these features?