Repository navigation
fix(cohere): record reasoning tokens as completion_reasoning_tokens - #2841
Open
BASIL K AJI (basil-k-aji-dev) wants to merge 1 commit into
Open
BASIL K AJI (basil-k-aji-dev) wants to merge 1 commit into
BASIL K AJI (basil-k-aji-dev) wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Cohere instrumentation logged reasoning tokens under the metric name
reasoning_tokens. The canonical name, read by Braintrust for cost and usage and used by every other JS provider (anthropic, google-genai, openai-agents, langchain, mastra and others), iscompletion_reasoning_tokens, as in #2813 for Genkit.mergeUsageMetricsnow emitscompletion_reasoning_tokensand no longer emitsreasoning_tokens. The input aliases (thinkingTokens,reasoningTokensand their snake_case forms) are handled as before, and zero values are still recorded.Tests
In
cohere-instrumentation.test.tsthe two existingreasoning_tokensexpectations now use the canonical name,.not.toHaveProperty("reasoning_tokens")is added on the aggregated stream metrics, and a new test covers a usage that reportsthinkingTokens. The expectation ine2e/scenarios/cohere-instrumentation/assertions.tsis updated too.reasoning_tokens: 6wherecompletion_reasoning_tokens: 6is expected, andundefinedfor the new test).providersdirectory passes (57 files, 1373 tests).check:typings,lintand the formatting check are clean, andvalidate-changesetspasses.Not covered
The e2e thinking assertion sits behind
supportsThinking, which isfalsefor every Cohere scenario spec today, so the e2e edit is not exercised by CI. I did not run the e2e scenarios.