ソースを参照
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)
tags/v0.10.0
Moonlit
1年前
コミッターのメールアドレスに関連付けられたアカウントが存在しません
|
|
|
@@ -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]) |