-
Notifications
You must be signed in to change notification settings - Fork 1.3k
tool can give alternative definition by model #1400
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Adds model-aware alternativeDefinition support so tools can provide different LanguageModelToolInformation depending on the selected model.
- Extends ICopilotTool.alternativeDefinition to accept the current model.
- Applies alternativeDefinition in three getEnabledTools implementations before filtering.
- Updates interface documentation to mention model-based customization.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| test/base/extHostContext/simulationExtHostToolsService.ts | Adds model-aware mapping to substitute tool definitions before filtering. |
| src/extension/tools/vscode-node/toolsService.ts | Introduces model-based alternativeDefinition application prior to existing enable/disable logic. |
| src/extension/tools/node/test/testToolsService.ts | Mirrors production logic for model-driven alternativeDefinition in test service. |
| src/extension/tools/common/toolsRegistry.ts | Updates ICopilotTool interface and docs to accept model info in alternativeDefinition. |
|
@bryanchen-d Just an idea, would it make sense to just expose tool-specific options? e.g., for removing |
Not sure if I follow, for models to pass options into tools, we already have This scenario is for passing the tool definition to models before models use the tool. Basically the challenge here is that the to-do list tool is defined in vscode while we want to modify the description in the extension based on model. Ideally we should centralize the tool definition in the extension. |
@bhavyaus has been refactoring code to centralize prompts belonging to a specific provider (e.g., see https://github.com/microsoft/vscode-copilot-chat/blob/main/src/extension/prompts/node/agent/openAIPrompts.tsx). Wondering if we could also control this behaviour from that file - but I think it could probably be done as a followup since we still have a lot of areas with these model conditionals sprinkled in several other places like the base instructions. Played around a bit with the idea here: https://github.com/microsoft/vscode-copilot-chat/pull/1681/files#diff-982afe7aa9d84aad97affd4ffbc0cab2bdda7e39338a69ec36931d413d9d3736 |
Hmm, then does the whole prompt become : ? |
…in tools and provide alternative definition.
280d32b to
12536e4
Compare
|
|
||
| alternativeDefinition(originTool: vscode.LanguageModelToolInformation, chatEndpoint: IChatEndpoint | undefined): vscode.LanguageModelToolInformation { | ||
| // specialize the tool definition for gpt-5 to reduce the frequency | ||
| if (chatEndpoint?.model === 'gpt-5') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And gpt-5-codex
Pass model info into the
alternativeDefinitionmethod ofICopilotToolto allow tools to provide alternative definition based on different models passing in.Fixes microsoft/vscode#270663