From 48052a9df242040ecce494d6c5542c8bc59dc510 Mon Sep 17 00:00:00 2001 From: Tomer Asida Date: Wed, 11 Sep 2024 13:48:33 +0300 Subject: [PATCH 1/2] bugfx: Fix the logic for deciding if tool parsing is used --- vllm/entrypoints/openai/serving_chat.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vllm/entrypoints/openai/serving_chat.py b/vllm/entrypoints/openai/serving_chat.py index a81d2aa989aaf..ad99aefb0f82e 100644 --- a/vllm/entrypoints/openai/serving_chat.py +++ b/vllm/entrypoints/openai/serving_chat.py @@ -608,7 +608,7 @@ async def chat_completion_full_generator( # if auto tools are not enabled, and a named tool choice using # outlines is not being used if not (self.enable_auto_tools - or not self.tool_parser) and not isinstance( + and not self.tool_parser) and not isinstance( request.tool_choice, ChatCompletionNamedToolChoiceParam): message = ChatMessage(role=role, content=output.text) From 55166639064309135442804f2c108c7eede38601 Mon Sep 17 00:00:00 2001 From: Tomer Asida Date: Wed, 11 Sep 2024 23:21:28 +0300 Subject: [PATCH 2/2] fix logic again following PR comment --- vllm/entrypoints/openai/serving_chat.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vllm/entrypoints/openai/serving_chat.py b/vllm/entrypoints/openai/serving_chat.py index ad99aefb0f82e..8ac4caffb37f0 100644 --- a/vllm/entrypoints/openai/serving_chat.py +++ b/vllm/entrypoints/openai/serving_chat.py @@ -607,8 +607,8 @@ async def chat_completion_full_generator( # if auto tools are not enabled, and a named tool choice using # outlines is not being used - if not (self.enable_auto_tools - and not self.tool_parser) and not isinstance( + if (not self.enable_auto_tools + or not self.tool_parser) and not isinstance( request.tool_choice, ChatCompletionNamedToolChoiceParam): message = ChatMessage(role=role, content=output.text)