Skip to content

Commit 867bf70

Browse files
authored
fix(model_runtime): ensure compatibility with O1 models by adjusting token parameters (langgenius#10537)
1 parent 9018ef3 commit 867bf70

File tree

1 file changed

+4
-0
lines changed
  • api/core/model_runtime/model_providers/openai/llm

1 file changed

+4
-0
lines changed

api/core/model_runtime/model_providers/openai/llm/llm.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,10 @@ def _chat_generate(
617617
# o1 compatibility
618618
block_as_stream = False
619619
if model.startswith("o1"):
620+
if "max_tokens" in model_parameters:
621+
model_parameters["max_completion_tokens"] = model_parameters["max_tokens"]
622+
del model_parameters["max_tokens"]
623+
620624
if stream:
621625
block_as_stream = True
622626
stream = False

0 commit comments

Comments
 (0)