add support for lmdeploy api judge (#1193)

This commit is contained in:
bittersweet1999 2024-05-24 23:28:56 +08:00 committed by GitHub
parent 749e4cea71
commit 88c14d3d04
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -184,8 +184,12 @@ class OpenAI(BaseAPIModel):
messages.append(msg)
# Hold out 100 tokens due to potential errors in tiktoken calculation
max_out_len = min(
max_out_len, context_window - self.get_token_len(str(input)) - 100)
try:
max_out_len = min(
max_out_len,
context_window - self.get_token_len(str(input)) - 100)
except KeyError:
max_out_len = max_out_len
if max_out_len <= 0:
return ''