Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix: o1-series model encounters an error when the generate mode is blocking (#8363)

takatost24af4b931384
diff --git a/api/core/model_runtime/model_providers/openai/llm/llm.py b/api/core/model_runtime/model_providers/openai/llm/llm.py
index 95533ccfaf7..60d69c6e472 100644
--- a/api/core/model_runtime/model_providers/openai/llm/llm.py
+++ b/api/core/model_runtime/model_providers/openai/llm/llm.py
@@ -615,10 +615,12 @@ class OpenAILargeLanguageModel(_CommonOpenAI, LargeLanguageModel):
block_as_stream = False
if model.startswith("o1"):
- block_as_stream = True
- stream = False
- if "stream_options" in extra_model_kwargs:
- del extra_model_kwargs["stream_options"]
+ if stream:
+ block_as_stream = True
+ stream = False
+
+ if "stream_options" in extra_model_kwargs:
+ del extra_model_kwargs["stream_options"]
if "stop" in extra_model_kwargs:
del extra_model_kwargs["stop"]