Skip to content

Conversation

okdshin
Copy link
Member

@okdshin okdshin commented Apr 25, 2025

Add option to include tool definitions even when tool_choice is 'none'

Summary

This PR adds a new command-line option --expand-tools-even-if-tool-choice-none which allows including tool definitions in prompts even when tool_choice='none'.

Motivation

In the current implementation, when tool_choice is set to 'none', all tool definitions are removed from the request, preventing the model from seeing the tool schemas. This change enables a workflow where:

  1. The model can be aware of available tools (via their definitions in the prompt)
  2. But is not expected to use them automatically (since tool_choice='none')

This is useful for:

  • Models that need to "plan" about available tools before using them in subsequent requests
  • Cases where tool descriptions provide useful context even if the tools aren't used
  • Situations where you want the model to reference tool capabilities in its response without actually calling them

Implementation

  • Added a new CLI flag --expand-tools-even-if-tool-choice-none (default: False)
  • Modified the request validation in protocol.py to no longer remove tools when tool_choice='none'
  • Added the new parameter to OpenAIServingChat and passed it through from the API server

Copy link

👋 Hi! Thank you for contributing to the vLLM project.

💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in #pr-reviews, coordinate on features in #feat- channels, or join special interest groups in #sig- channels.

Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run fastcheck CI which starts running only a small and essential subset of CI tests to quickly catch errors. You can run other CI tests on top of those by going to your fastcheck build on Buildkite UI (linked in the PR checks section) and unblock them. If you do not have permission to unblock, ping simon-mo or khluu to add you in our Buildkite org.

Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging.

To run CI, PR reviewers can either: Add ready label to the PR or enable auto-merge.

🚀

@okdshin okdshin force-pushed the specifiable_tools_expansion branch 5 times, most recently from ef2bf5f to 25aec8d Compare June 14, 2025 13:29
yeqcharlotte and others added 23 commits June 16, 2025 06:30
…ength from tokenizer config (vllm-project#19660)

Signed-off-by: Ye (Charlotte) Qi <yeq@meta.com>
Signed-off-by: Chengji Yao <chengjiyao@google.com>
Co-authored-by: mgoin <mgoin64@gmail.com>
Signed-off-by: Andy Xie <andy.xning@gmail.com>
Signed-off-by: Russell Bryant <rbryant@redhat.com>
)

Signed-off-by: SzymonOzog <szymon.ozog@gmail.com>
Signed-off-by: Andy Xie <andy.xning@gmail.com>
…oject#19662)

Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com>
Signed-off-by: Bill Nell <bnell@redhat.com>
…h MiniMaxText01ForCausalLM) (vllm-project#19677)

Signed-off-by: QscQ <qscqesze@gmail.com>
…19446)

Signed-off-by: Russell Bryant <rbryant@redhat.com>
…t#19641)

Signed-off-by: conroy-cheers <conroy@corncheese.org>
Signed-off-by: David Xia <david@davidxia.com>
Signed-off-by: nguyenhoangthuan99 <thuanhppro12@gmail.com>
Signed-off-by: Di Liu <liu-di@sjtu.edu.cn>
Signed-off-by: drisspg <drisspguessous@gmail.com>
…er (vllm-project#19686)

Signed-off-by: 刘全 <quan.liu2@dbappsecurity.com.cn>
Co-authored-by: 刘全 <quan.liu2@dbappsecurity.com.cn>
qli88 and others added 15 commits June 20, 2025 12:43
Signed-off-by: Qiang Li <qiang.li2@amd.com>
Signed-off-by: reidliu41 <reid201711@gmail.com>
Co-authored-by: reidliu41 <reid201711@gmail.com>
…9851)

Signed-off-by: reidliu41 <reid201711@gmail.com>
Co-authored-by: reidliu41 <reid201711@gmail.com>
Signed-off-by: Thomas Parnell <tpa@zurich.ibm.com>
Signed-off-by: nie3e <adrcwiek@gmail.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: wangxiyuan <wangxiyuan1007@gmail.com>
…t#19910)

Signed-off-by: Rabin Adhikari <rabin.adk1@gmail.com>
Signed-off-by: Isotr0py <2037008807@qq.com>
Signed-off-by: 汪志鹏 <wangzhipeng628@gmail.com>
@okdshin okdshin force-pushed the specifiable_tools_expansion branch from 35649de to f2bc427 Compare June 21, 2025 14:36
okdshin added 8 commits June 21, 2025 23:59
Signed-off-by: okada shintarou <okada@preferred.jp>
Signed-off-by: okada shintarou <okada@preferred.jp>
Signed-off-by: okada shintarou <okada@preferred.jp>
Signed-off-by: okada shintarou <okada@preferred.jp>
This reverts commit 377f4ac3d47d67ca05ed2df6054aab6faec02b4d.

Signed-off-by: okada shintarou <okada@preferred.jp>
Signed-off-by: okada shintarou <okada@preferred.jp>
Signed-off-by: okada shintarou <okada@preferred.jp>
Signed-off-by: okada shintarou <okada@preferred.jp>
@okdshin okdshin force-pushed the specifiable_tools_expansion branch from 9559897 to e282ebb Compare June 21, 2025 15:00
okdshin and others added 3 commits June 22, 2025 00:14
Signed-off-by: okada shintarou <okada@preferred.jp>
Signed-off-by: okada shintarou <okada@preferred.jp>
Co-authored-by: Aaron Pham <Aaronpham0103@gmail.com>
Signed-off-by: okada shintarou <okada@preferred.jp>
@okdshin okdshin force-pushed the specifiable_tools_expansion branch from 8750191 to 90eabb2 Compare June 22, 2025 07:56
Signed-off-by: okada shintarou <okada@preferred.jp>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.