🪙 fix: usage check for reasoning_tokens

This commit is contained in:
Danny Avila 2024-09-13 09:51:09 -04:00
parent c792e3279f
commit f1ae267850
No known key found for this signature in database
GPG key ID: 2DD9CC89B9B50364

View file

@ -1096,7 +1096,12 @@ ${convo}
{ promptTokens, completionTokens }, { promptTokens, completionTokens },
); );
if (typeof usage === 'object' && typeof usage.reasoning_tokens === 'number') { if (
usage &&
typeof usage === 'object' &&
'reasoning_tokens' in usage &&
typeof usage.reasoning_tokens === 'number'
) {
await spendTokens( await spendTokens(
{ {
context: 'reasoning', context: 'reasoning',