Skip to content

Commit 2155e95

Browse files
[Bugfix] Fix the issue where reasoning_content is None when Thinkng is enabled and tool_choice is set to 'required'. (#20662)
Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com>
1 parent f95570a commit 2155e95

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

tests/entrypoints/openai/test_completion_with_function_calling.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,11 @@ async def test_function_tool_use(client: openai.AsyncOpenAI, model_name: str,
145145
"enable_thinking": enable_thinking
146146
}
147147
})
148-
148+
if enable_thinking:
149+
assert chat_completion.choices[0].message.\
150+
reasoning_content is not None
151+
assert chat_completion.choices[0].message.\
152+
reasoning_content != ""
149153
assert chat_completion.choices[0].message.tool_calls is not None
150154
assert len(chat_completion.choices[0].message.tool_calls) > 0
151155
else:

vllm/entrypoints/openai/serving_chat.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1049,6 +1049,7 @@ async def chat_completion_full_generator(
10491049
message = ChatMessage(
10501050
role=role,
10511051
content="",
1052+
reasoning_content=reasoning_content,
10521053
tool_calls=[
10531054
tool_call_class(function=FunctionCall(
10541055
name=tool_call.name,

0 commit comments

Comments
 (0)