Fix: o1 input parameter must be max_completion_tokens

This commit is contained in:
kivvi 2024-09-26 08:49:59 +08:00
parent e268ee5675
commit 405d0561df
No known key found for this signature in database
GPG Key ID: 64665186EEA23C1D

View File

@ -415,6 +415,9 @@ async def generate_chat_completion(
payload["max_tokens"] = payload["max_completion_tokens"] payload["max_tokens"] = payload["max_completion_tokens"]
del payload["max_completion_tokens"] del payload["max_completion_tokens"]
else: else:
if payload["model"].lower().startswith("o1-") and "max_tokens" in payload:
payload["max_completion_tokens"] = payload["max_tokens"]
del payload["max_tokens"]
if "max_tokens" in payload and "max_completion_tokens" in payload: if "max_tokens" in payload and "max_completion_tokens" in payload:
del payload["max_tokens"] del payload["max_tokens"]