mirror of
https://github.com/agentscope-ai/ReMe.git
synced 2026-10-07 03:00:27 +00:00
fix(token-counter): handle non-positive divisor in token estimation
Some checks failed
Pre-commit / run (ubuntu-latest) (push) Has been cancelled
Some checks failed
Pre-commit / run (ubuntu-latest) (push) Has been cancelled
- Changed condition from divisor equals zero to divisor less than or equal to zero - Prevents division by zero error when estimate_divisor is negative - Maintains validation logic for invalid divisor values
This commit is contained in:
parent
baf110e602
commit
b202fc3fba
1 changed files with 1 additions and 1 deletions
|
|
@ -19,7 +19,7 @@ class EstimatedTokenCounter(TokenCounterBase):
|
|||
Default 4 assumes roughly 4 characters per token.
|
||||
Use 2-3 for Chinese/Japanese text, 4-5 for English.
|
||||
"""
|
||||
if estimate_divisor == 0:
|
||||
if estimate_divisor <= 0:
|
||||
raise ValueError("estimate_divisor cannot be zero")
|
||||
self.estimate_divisor: float = estimate_divisor
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue