-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Fix Groq context window display #7839
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -66,20 +66,9 @@ export class GroqHandler extends BaseOpenAiCompatibleProvider<GroqModelId> { | |
| // Calculate cost using OpenAI-compatible cost calculation | ||
| const totalCost = calculateApiCostOpenAI(info, inputTokens, outputTokens, cacheWriteTokens, cacheReadTokens) | ||
|
|
||
| // Calculate non-cached input tokens for proper reporting | ||
| const nonCachedInputTokens = Math.max(0, inputTokens - cacheReadTokens - cacheWriteTokens) | ||
|
|
||
| console.log("usage", { | ||
| inputTokens: nonCachedInputTokens, | ||
| outputTokens, | ||
| cacheWriteTokens, | ||
| cacheReadTokens, | ||
| totalCost, | ||
| }) | ||
|
|
||
| yield { | ||
| type: "usage", | ||
| inputTokens: nonCachedInputTokens, | ||
| inputTokens, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good to see the test was updated to match this change! However, could you clarify what specific issue this fixes? The PR title mentions "Fix Groq context window display" but it's not clear what was broken. Also, is this token reporting approach intentional? This makes Groq's behavior different from how it previously worked (subtracting cached tokens from input tokens). The base OpenAI provider reports total tokens, but some other providers handle cached tokens differently. Could you explain the reasoning behind this change? |
||
| outputTokens, | ||
| cacheWriteTokens, | ||
| cacheReadTokens, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.