Browse Source

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 year ago
parent
commit
59ba34e167
No account linked to committer's email address
1 changed files with 1 additions and 1 deletions
  1. 1
    1
      rag/utils/__init__.py

+ 1
- 1
rag/utils/__init__.py View File

@@ -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…
Cancel
Save