fix(anthropic): accept integral float cache token counts

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
This commit is contained in:
Kannan Priyadharshan 2026-06-23 20:50:27 +08:00 • committed by GitHub
parent 60da357c16
commit 7e6dd8d460
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1404,8 +1404,8 @@ class LiteLLMAnthropicMessagesAdapter:
@staticmethod
def _positive_int(value: object) -> int:
if isinstance(value, int) and value > 0:
return value
if isinstance(value, (int, float)) and not isinstance(value, bool) and value > 0:
return int(value)
return 0
@classmethod