feat: add completion tokens details for anthropic models - #2199
Conversation
Signed-off-by: yxia216 <yxia216@bloomberg.net>
b347896 to
174a988
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2199 +/- ##
=======================================
Coverage 84.71% 84.72%
=======================================
Files 144 144
Lines 21161 21171 +10
=======================================
+ Hits 17927 17937 +10
Misses 2152 2152
Partials 1082 1082 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Signed-off-by: yxia216 <yxia216@bloomberg.net>
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request updates the Anthropic SDK dependency to v1.46.0 and introduces support for extracting and translating reasoning (thinking) tokens into OpenAI's CompletionTokensDetails.ReasoningTokens format for both streaming and non-streaming responses. Feedback on the changes points out potential nil pointer dereference panics in the AWS and GCP Anthropic translator tests when accessing CompletionTokensDetails directly, suggesting safe inline checks to handle cases where this field might be nil.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
/retest |
Signed-off-by: yxia216 <yxia216@bloomberg.net>
Signed-off-by: hustxiayang <yxia216@bloomberg.net>
…2199) **Description** Anthropic recently exposed the reasoning tokens via `output_tokens_details`: https://platform.claude.com/docs/en/api/python/messages/create. Thus we should also added this usage information for our users. --------- Signed-off-by: yxia216 <yxia216@bloomberg.net> Co-authored-by: Ignasi Barrera <ignasi@tetrate.io> Signed-off-by: yxia216 <yxia216@bloomberg.net>
…2199) **Description** Anthropic recently exposed the reasoning tokens via `output_tokens_details`: https://platform.claude.com/docs/en/api/python/messages/create. Thus we should also added this usage information for our users. --------- Signed-off-by: yxia216 <yxia216@bloomberg.net> Co-authored-by: Ignasi Barrera <ignasi@tetrate.io> Signed-off-by: yxia216 <yxia216@bloomberg.net>
Description
Anthropic recently exposed the reasoning tokens via
output_tokens_details: https://platform.claude.com/docs/en/api/python/messages/create. Thus we should also added this usage information for our users.