refine API request data processing (#1031)

### What problem does this PR solve?

#1024 

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
KevinHuSh
2024-06-03 09:02:25 +08:00
committed by GitHub
parent cdea1d0a85
commit cc064040a2
2 changed files with 16 additions and 15 deletions

View File

@ -115,7 +115,7 @@ class YoudaoRerank(DefaultRerank):
"maidalun1020", "InfiniFlow"))
def similarity(self, query: str, texts: list):
pairs = [(query,truncate(t, self._model.max_length)) for t in texts]
pairs = [(query, truncate(t, self._model.max_length)) for t in texts]
token_count = 0
for _, t in pairs:
token_count += num_tokens_from_string(t)