Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

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

Moonlit59ba34e167a0
diff --git a/rag/utils/__init__.py b/rag/utils/__init__.py
index 63bb582a70..8f0d8c28fe 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])