Unverified Commit 2155e95e authored by Chauncey's avatar Chauncey Committed by GitHub
Browse files

[Bugfix] Fix the issue where `reasoning_content` is `None` when Thinkng is...


[Bugfix] Fix the issue where `reasoning_content` is `None` when Thinkng is enabled and `tool_choice` is set to `'required'`. (#20662)
Signed-off-by: default avatarchaunceyjiang <chaunceyjiang@gmail.com>
parent f95570a5
...@@ -145,7 +145,11 @@ async def test_function_tool_use(client: openai.AsyncOpenAI, model_name: str, ...@@ -145,7 +145,11 @@ async def test_function_tool_use(client: openai.AsyncOpenAI, model_name: str,
"enable_thinking": enable_thinking "enable_thinking": enable_thinking
} }
}) })
if enable_thinking:
assert chat_completion.choices[0].message.\
reasoning_content is not None
assert chat_completion.choices[0].message.\
reasoning_content != ""
assert chat_completion.choices[0].message.tool_calls is not None assert chat_completion.choices[0].message.tool_calls is not None
assert len(chat_completion.choices[0].message.tool_calls) > 0 assert len(chat_completion.choices[0].message.tool_calls) > 0
else: else:
......
...@@ -1049,6 +1049,7 @@ class OpenAIServingChat(OpenAIServing): ...@@ -1049,6 +1049,7 @@ class OpenAIServingChat(OpenAIServing):
message = ChatMessage( message = ChatMessage(
role=role, role=role,
content="", content="",
reasoning_content=reasoning_content,
tool_calls=[ tool_calls=[
tool_call_class(function=FunctionCall( tool_call_class(function=FunctionCall(
name=tool_call.name, name=tool_call.name,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment