Skip to content

Commit 33cc22e

Browse files
committed
[Bug] Fix missing tool usage check
Fixed a bug where the commentary value was missing in Invalid Channel due to the absence of with_custom_tools value when fetching the system message. Signed-off-by: kyt <[email protected]>
1 parent 73cfb3c commit 33cc22e

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

tests/entrypoints/openai/test_response_api_with_harmony.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,22 @@ async def test_function_calling_required(client: OpenAI, model_name: str):
602602
)
603603

604604

605+
@pytest.mark.asyncio
606+
@pytest.mark.parametrize("model_name", [MODEL_NAME])
607+
async def test_system_message_with_tools(client: OpenAI, model_name: str):
608+
from vllm.entrypoints.harmony_utils import get_system_message
609+
610+
# Test with custom tools enabled - commentary channel should be available
611+
sys_msg = get_system_message(with_custom_tools=True)
612+
valid_channels = sys_msg.content[0].channel_config.valid_channels
613+
assert "commentary" in valid_channels
614+
615+
# Test with custom tools disabled - commentary channel should be removed
616+
sys_msg = get_system_message(with_custom_tools=False)
617+
valid_channels = sys_msg.content[0].channel_config.valid_channels
618+
assert "commentary" not in valid_channels
619+
620+
605621
@pytest.mark.asyncio
606622
@pytest.mark.parametrize("model_name", [MODEL_NAME])
607623
async def test_function_calling_full_history(client: OpenAI, model_name: str):

vllm/entrypoints/openai/serving_chat.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1566,7 +1566,9 @@ def _make_request_with_harmony(
15661566
sys_msg = get_system_message(
15671567
reasoning_effort=request.reasoning_effort,
15681568
browser_description=None,
1569-
python_description=None)
1569+
python_description=None,
1570+
with_custom_tools=request.tools is not None
1571+
)
15701572
messages.append(sys_msg)
15711573

15721574
# Add developer message.

0 commit comments

Comments
 (0)