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.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
fix: possible unsent function call in the last chunk of streaming response in OpenAI provider (#2422)
Bowen Liang589099a00516
diff --git a/api/core/model_runtime/model_providers/openai/llm/llm.py b/api/core/model_runtime/model_providers/openai/llm/llm.pyindex 56a88884f8e..92a370e0474 100644--- a/api/core/model_runtime/model_providers/openai/llm/llm.py+++ b/api/core/model_runtime/model_providers/openai/llm/llm.py@@ -497,8 +497,9 @@ class OpenAILargeLanguageModel(_CommonOpenAI, LargeLanguageModel):continuedelta = chunk.choices[0]+ has_finish_reason = delta.finish_reason is not None- if delta.finish_reason is None and (delta.delta.content is None or delta.delta.content == '') and \+ if not has_finish_reason and (delta.delta.content is None or delta.delta.content == '') and \delta.delta.function_call is None:continue@@ -520,7 +521,8 @@ class OpenAILargeLanguageModel(_CommonOpenAI, LargeLanguageModel):if assistant_message_function_call:# start of stream function calldelta_assistant_message_function_call_storage = assistant_message_function_call- continue+ if not has_finish_reason:+ continue# tool_calls = self._extract_response_tool_calls(assistant_message_tool_calls)function_call = self._extract_response_function_call(assistant_message_function_call)@@ -534,7 +536,7 @@ class OpenAILargeLanguageModel(_CommonOpenAI, LargeLanguageModel):full_assistant_content += delta.delta.content if delta.delta.content else ''- if delta.finish_reason is not None:+ if has_finish_reason:# calculate num tokensprompt_tokens = self._num_tokens_from_messages(model, prompt_messages, tools)