google / google/generative-ai-go
Potential Token Counting Issue in SDK Version [v0.19.0]
- Dominant language
- Go
- Stars
- 857
- Forks
- 104
- PR merge metrics
- No merged PRs in 30d
Description
### Description of the bug:
version is github.com/google/generative-ai-go v0.19.0
Description:
Hello, I encountered an issue with the current SDK version:
PromptTokenCount equals TotalTokenCount, implying there are zero tokens allocated for output.
All Candidates tokens consistently show 0 in this scenario.
This appears to contradict expected behavior, as successful responses should logically include output tokens. Could you confirm whether this is intentional or a potential bug?
Thank you for your attention to this matter. Let me know if additional details or testing would be helpful.
This version:v0.19.0
### Actual vs expected behavior:
TotalTokenCount should be greater than PromptTokenCount.
And each Candidates' TokenCount field should have a value:Candidates
### Any other information you'd like to share?
_No response_
Contributor guide
Research direction
Start by reproducing the reported behavior with github.com/google/generative-ai-go v0.19.0 and inspect the response's PromptTokenCount, TotalTokenCount, and Candidates token fields. Done means determining whether the zero output counts are intentional or correcting the behavior so successful responses report output and candidate token counts as expected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- api
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100