Unverified Commit 88c14d3d authored by bittersweet1999's avatar bittersweet1999 Committed by GitHub
Browse files

add support for lmdeploy api judge (#1193)

parent 749e4cea
...@@ -184,8 +184,12 @@ class OpenAI(BaseAPIModel): ...@@ -184,8 +184,12 @@ class OpenAI(BaseAPIModel):
messages.append(msg) messages.append(msg)
# Hold out 100 tokens due to potential errors in tiktoken calculation # Hold out 100 tokens due to potential errors in tiktoken calculation
max_out_len = min( try:
max_out_len, context_window - self.get_token_len(str(input)) - 100) 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: if max_out_len <= 0:
return '' return ''
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment