From 59ba34e167a0f63f82f0638993fd15cd960c66b7 Mon Sep 17 00:00:00 2001 From: Moonlit Date: Thu, 22 Aug 2024 09:29:02 +0800 Subject: [PATCH] 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) --- rag/utils/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rag/utils/__init__.py b/rag/utils/__init__.py index 63bb582a7..8f0d8c28f 100644 --- a/rag/utils/__init__.py +++ b/rag/utils/__init__.py @@ -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])