Moonlit
commited on
Commit
·
cd22cf3
1
Parent(s):
ce796e3
fix: Fix return type annotation in truncate function (#2044)
Browse files### 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)
- rag/utils/__init__.py +1 -1
rag/utils/__init__.py
CHANGED
@@ -85,6 +85,6 @@ def num_tokens_from_string(string: str) -> int:
|
|
85 |
return 0
|
86 |
|
87 |
|
88 |
-
def truncate(string: str, max_len: int) ->
|
89 |
"""Returns truncated text if the length of text exceed max_len."""
|
90 |
return encoder.decode(encoder.encode(string)[:max_len])
|
|
|
85 |
return 0
|
86 |
|
87 |
|
88 |
+
def truncate(string: str, max_len: int) -> str:
|
89 |
"""Returns truncated text if the length of text exceed max_len."""
|
90 |
return encoder.decode(encoder.encode(string)[:max_len])
|