Skip to content

Commit 6fe9cd3

Browse files
committed
fix: enhance reasoning content handling in base_chat_open_ai.py
1 parent c0762a7 commit 6fe9cd3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

apps/models_provider/impl/base_chat_open_ai.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ def _convert_delta_to_message_chunk(
3232
role = cast(str, _dict.get("role"))
3333
content = cast(str, _dict.get("content") or "")
3434
additional_kwargs: dict = {}
35-
if 'reasoning_content' in _dict:
36-
additional_kwargs['reasoning_content'] = _dict.get('reasoning_content')
35+
if 'reasoning_content' in _dict or 'reasoning' in _dict:
36+
additional_kwargs['reasoning_content'] = _dict.get('reasoning_content') or _dict.get('reasoning')
3737
if _dict.get("function_call"):
3838
function_call = dict(_dict["function_call"])
3939
if "name" in function_call and function_call["name"] is None:
@@ -79,7 +79,7 @@ def _convert_delta_to_message_chunk(
7979
)
8080
if role or default_class == ChatMessageChunk:
8181
return ChatMessageChunk(content=content, role=role, id=id_)
82-
return default_class(content=content, id=id_) # type: ignore[call-arg]#
82+
return default_class(content=content, id=id_) # type: ignore[call-arg]
8383

8484

8585
class BaseChatOpenAI(ChatOpenAI):

0 commit comments

Comments
 (0)