Skip to content

fix(google_genai): include thinking tokens in completion usage - #619

Closed
ekeith (evanmkeith) wants to merge 2 commits into
mainfrom
07-27-fix-gemini-thinking-tokens-completion-tokens
Closed

fix(google_genai): include thinking tokens in completion usage#619
ekeith (evanmkeith) wants to merge 2 commits into
mainfrom
07-27-fix-gemini-thinking-tokens-completion-tokens

Conversation

@evanmkeith

@evanmkeith ekeith (evanmkeith) commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Fold Gemini thoughts_token_count into Google GenAI completion_tokens
  • Preserve completion_reasoning_tokens as the separate reasoning detail metric
  • Tighten the reasoning regression test to assert span metrics match provider usage metadata

Testing

  • nox -s "test_google_genai(latest)" -- -k test_reasoning
  • nox -s "test_google_genai(latest)"
  • nox -s "test_google_genai(1.75.0)" -- -k test_reasoning
  • nox -s "test_google_genai(1.30.0)" -- -k test_reasoning
  • git diff --check

Related to https://linear.app/braintrustdata/issue/SDK-99

## Summary

  - Fold Gemini `thoughts_token_count` into Google GenAI `completion_tokens`
  - Preserve `completion_reasoning_tokens` as the separate reasoning detail metric
  - Tighten the reasoning regression test to assert span metrics match provider usage metadata

  ## Testing

  - `nox -s "test_google_genai(latest)" -- -k test_reasoning`
  - `nox -s "test_google_genai(latest)"`
  - `nox -s "test_google_genai(1.75.0)" -- -k test_reasoning`
  - `nox -s "test_google_genai(1.30.0)" -- -k test_reasoning`
  - `git diff --check`
@evanmkeith ekeith (evanmkeith) changed the title ix(google_genai): include thinking tokens in completion usage fix(google_genai): include thinking tokens in completion usage Jul 27, 2026
@AbhiPrasad

Copy link
Copy Markdown
Member

This needs a more robust fix, so closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants