10000 Update lm tool tags (#25108) · s-kai273/vscode-python@186bedd · GitHub
[go: up one dir, main page]

Skip to content

Commit 186bedd

Browse files
authored
Update lm tool tags (microsoft#25108)
1 parent 5035e88 commit 186bedd

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

package.json

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@
8282
"onLanguageModelTool:get_python_environment_details",
8383
"onLanguageModelTool:get_python_executable_details",
8484
"onLanguageModelTool:install_python_packages",
85-
"onLanguageModelTool:configure_python_environment"
85+
"onLanguageModelTool:configure_python_environment",
86+
"onLanguageModelTool:create_virtual_environment"
8687
],
8788
"main": "./out/client/extension",
8889
"browser": "./dist/extension.browser.js",
@@ -1523,6 +1524,7 @@
15231524
"modelDescription": "Installs Python packages in the given workspace. Use this tool to install packages in the user's chosen environment. ALWAYS call configure_python_environment before using this tool.",
15241525
"toolReferenceName": "pythonInstallPackage",
15251526
"tags": [
1527+
"install python package",
15261528
"extension_installed_by_tool",
15271529
"enable_other_tool_configure_python_environment"
15281530
],
@@ -1576,9 +1578,7 @@
15761578
"name": "create_virtual_environment",
15771579
"displayName": "Create a Virtual Environment",
15781580
"modelDescription": "This tool will create a Virual Environment",
1579-
"tags": [
1580-
"extension_installed_by_tool"
1581-
],
1581+
"tags": [],
15821582
"canBeReferencedInPrompt": false,
15831583
"inputSchema": {
15841584
"type": "object",
@@ -1596,9 +1596,7 @@
15961596
"name": "selectEnvironment",
15971597
"displayName": "Select a Python Environment",
15981598
"modelDescription": "This tool will prompt the user to select an existing Python Environment",
1599-
"tags": [
1600-
"extension_installed_by_tool"
1601-
],
1599+
"tags": [],
16021600
"canBeReferencedInPrompt": false,
16031601
"inputSchema": {
16041602
"type": "object",

src/client/chat/configurePythonEnvTool.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import { ITerminalHelper } from '../common/terminal/types';
2828
import { IRecommendedEnvironmentService } from '../interpreter/configuration/types';
2929
import { CreateVirtualEnvTool } from './createVirtualEnvTool';
3030
import { ISelectPythonEnvToolArguments, SelectPythonEnvTool } from './selectEnvTool';
31+
import { useEnvExtension } from '../envExt/api.internal';
3132

3233
export class ConfigurePythonEnvTool implements LanguageModelTool<IResourceReference> {
3334
private readonly terminalExecutionService: TerminalCodeExecutionProvider;
@@ -77,7 +78,10 @@ export class ConfigurePythonEnvTool implements LanguageModelTool<IResourceRefere
7778

7879
if (await this.createEnvTool.shouldCreateNewVirtualEnv(resource, token)) {
7980
try {
80-
return await lm.invokeTool(CreateVirtualEnvTool.toolName, options, token);
81+
// If the Python Env extension is available, then use that.
82+
// create_quick_virtual_environment
83+
const toolName = useEnvExtension() ? 'create_quick_virtual_environment' : CreateVirtualEnvTool.toolName;
84+
return await lm.invokeTool(toolName, options, token);
8185
} catch (ex) {
8286
if (isCancellationError(ex)) {
8387
const input: ISelectPythonEnvToolArguments = {

src/client/chat/createVirtualEnvTool.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ export class CreateVirtualEnvTool implements LanguageModelTool<IResourceReferenc
161161
title: l10n.t('Create a Virtual Environment{0}?', version ? ` (${version})` : ''),
162162
message: l10n.t(`Virtual Environments provide the benefit of package isolation and more.`),
163163
},
164+
invocationMessage: l10n.t('Creating a Virtual Environment'),
164165
};
165166
}
166167
async hasAlreadyGotAWorkspaceSpecificEnvironment(resource: Uri | undefined) {

0 commit comments

Comments
 (0)
0