fix: count reasoning content into token estimation (#2276)

This commit is contained in:
Zicheng Zhang 2025-02-25 08:24:53 +08:00 committed by GitHub
parent 88dd75827a
commit c233ba0a1c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -64,7 +64,8 @@ export async function estimateMessageUsage(message: Message): Promise<Completion
}
}
const tokens = estimateTextTokens(message.content)
const combinedContent = [message.content, message.reasoning_content].filter((s) => s !== undefined).join(' ')
const tokens = estimateTextTokens(combinedContent)
return {
prompt_tokens: tokens,