Unverified Commit 2ed3f20d authored by kyt's avatar kyt Committed by GitHub
Browse files

[openai] Fix missing tool usage check (system message) (#24768)


Signed-off-by: default avatarkyt <eluban4532@gmail.com>
parent 48f30902
......@@ -698,6 +698,22 @@ async def test_function_calling_required(client: OpenAI, model_name: str):
)
@pytest.mark.asyncio
@pytest.mark.parametrize("model_name", [MODEL_NAME])
async def test_system_message_with_tools(client: OpenAI, model_name: str):
from vllm.entrypoints.harmony_utils import get_system_message
# Test with custom tools enabled - commentary channel should be available
sys_msg = get_system_message(with_custom_tools=True)
valid_channels = sys_msg.content[0].channel_config.valid_channels
assert "commentary" in valid_channels
# Test with custom tools disabled - commentary channel should be removed
sys_msg = get_system_message(with_custom_tools=False)
valid_channels = sys_msg.content[0].channel_config.valid_channels
assert "commentary" not in valid_channels
@pytest.mark.asyncio
@pytest.mark.parametrize("model_name", [MODEL_NAME])
async def test_function_calling_full_history(client: OpenAI, model_name: str):
......
......@@ -1575,7 +1575,9 @@ class OpenAIServingChat(OpenAIServing):
sys_msg = get_system_message(
reasoning_effort=request.reasoning_effort,
browser_description=None,
python_description=None)
python_description=None,
with_custom_tools=request.tools is not None
)
messages.append(sys_msg)
# Add developer message.
......
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