mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-08 22:21:35 +00:00
fix: handle None or empty contents in Gemini token counter (#17020)
Adds null/empty check before processing contents in GoogleAIStudioTokenCounter to prevent errors when contents is None or empty. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
parent
629404a100
commit
84e8b9a7bf
1 changed files with 4 additions and 0 deletions
|
|
@ -30,6 +30,10 @@ class GoogleAIStudioTokenCounter:
|
|||
|
||||
from google.genai.types import FunctionResponse
|
||||
|
||||
# Handle None or empty contents
|
||||
if not contents:
|
||||
return contents
|
||||
|
||||
cleaned_contents = copy.deepcopy(contents)
|
||||
|
||||
for content in cleaned_contents:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue