A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 14, 05:30 UTC
[openai] Fix missing tool usage check (system message) (#24768)
Signed-off-by: kyt <eluban4532@gmail.com>
kyt committed
Oct 3, 2025 at 19:55 UTC
2ed3f20dba3ca28405eaf9c1ad7e23ba0b843906
2 files changed
+19
-1
tests/entrypoints/openai/test_response_api_with_harmony.py
+16
@@ -698,6 +698,22 @@ async def test_function_calling_required(client: OpenAI, model_name: str):
698
)
699
700
701
+@pytest.mark.asyncio
702
+@pytest.mark.parametrize("model_name", [MODEL_NAME])
703
+async def test_system_message_with_tools(client: OpenAI, model_name: str):
704
+ from vllm.entrypoints.harmony_utils import get_system_message
705
+
706
+ # Test with custom tools enabled - commentary channel should be available
707
+ sys_msg = get_system_message(with_custom_tools=True)
708
+ valid_channels = sys_msg.content[0].channel_config.valid_channels
709
+ assert "commentary" in valid_channels
710
+
711
+ # Test with custom tools disabled - commentary channel should be removed
712
+ sys_msg = get_system_message(with_custom_tools=False)
713
+ valid_channels = sys_msg.content[0].channel_config.valid_channels
714
+ assert "commentary" not in valid_channels
715
+
716
+
717
@pytest.mark.asyncio
718
@pytest.mark.parametrize("model_name", [MODEL_NAME])
719
async def test_function_calling_full_history(client: OpenAI, model_name: str):
vllm/entrypoints/openai/serving_chat.py
+3
-1
@@ -1575,7 +1575,9 @@ class OpenAIServingChat(OpenAIServing):
1575
sys_msg = get_system_message(
1576
reasoning_effort=request.reasoning_effort,
1577
browser_description=None,
1578
- python_description=None)
1578
+ python_description=None,
1579
+ with_custom_tools=request.tools is not None
1580
+ )
1581
messages.append(sys_msg)
1582
1583
# Add developer message.