fix: Fix return type annotation in truncate function (#2044)

### What problem does this PR solve?

Fix return type annotation in truncate function

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
Moonlit 2024-08-22 09:29:02 +08:00 committed by GitHub
parent 4580ad2fd7
commit 59ba34e167
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -85,6 +85,6 @@ def num_tokens_from_string(string: str) -> int:
return 0 return 0
def truncate(string: str, max_len: int) -> int: def truncate(string: str, max_len: int) -> str:
"""Returns truncated text if the length of text exceed max_len.""" """Returns truncated text if the length of text exceed max_len."""
return encoder.decode(encoder.encode(string)[:max_len]) return encoder.decode(encoder.encode(string)[:max_len])