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:
parent
4580ad2fd7
commit
59ba34e167
1 changed files with 1 additions and 1 deletions
|
|
@ -85,6 +85,6 @@ def num_tokens_from_string(string: str) -> int:
|
|||
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."""
|
||||
return encoder.decode(encoder.encode(string)[:max_len])
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue