Skip to content

Add option "--expand-tools-even-if-tool-choice-none" #17177

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

okdshin
Copy link

@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.

🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

2 participants