Skip to content

Commit ceef32e

Browse files
committed
Update tool names and args
1 parent 89395aa commit ceef32e

4 files changed

Lines changed: 18 additions & 18 deletions

File tree

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@
487487
],
488488
"languageModelTools": [
489489
{
490-
"name": "python_environment_tool",
490+
"name": "python_environment",
491491
"displayName": "Get Python Environment Information",
492492
"modelDescription": "Provides details about the Python environment for a specified file or workspace, including environment type, Python version, run command, and installed packages with their versions.",
493493
"toolReferenceName": "pythonGetEnvironmentInfo",
@@ -508,7 +508,7 @@
508508
}
509509
},
510510
{
511-
"name": "python_install_package_tool",
511+
"name": "python_install_package",
512512
"displayName": "Install Python Package",
513513
"modelDescription": "Installs Python packages in the given workspace. Use this tool to install packages in the user's chosen environment.",
514514
"toolReferenceName": "pythonInstallPackage",
@@ -525,14 +525,14 @@
525525
},
526526
"description": "The list of packages to install."
527527
},
528-
"workspacePath": {
528+
"resourcePath": {
529529
"type": "string",
530-
"description": "Path to Python workspace that determines the environment for package installation."
530+
"description": "The path to the Python file or workspace to get the environment information for."
531531
}
532532
},
533533
"required": [
534534
"packageList",
535-
"workspacePath"
535+
"resourcePath"
536536
]
537537
}
538538
}

src/extension.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ export async function activate(context: ExtensionContext): Promise<PythonEnviron
108108

109109
context.subscriptions.push(
110110
registerCompletionProvider(envManagers),
111-
registerTools('python_environment_tool', new GetEnvironmentInfoTool(api, envManagers)),
112-
registerTools('python_install_package_tool', new InstallPackageTool(api)),
111+
registerTools('python_environment', new GetEnvironmentInfoTool(api, envManagers)),
112+
registerTools('python_install_package', new InstallPackageTool(api)),
113113
commands.registerCommand('python-envs.viewLogs', () => outputChannel.show()),
114114
commands.registerCommand('python-envs.refreshManager', async (item) => {
115115
await refreshManagerCommand(item);

src/features/copilotTools.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ function BuildEnvironmentInfoContent(envInfo: EnvironmentInfo): LanguageModelTex
164164
*/
165165
export interface IInstallPackageInput {
166166
packageList: string[];
167-
workspacePath?: string;
167+
resourcePath?: string;
168168
}
169169

170170
/**
@@ -192,7 +192,7 @@ export class InstallPackageTool implements LanguageModelTool<IInstallPackageInpu
192192
});
193193

194194
const parameters: IInstallPackageInput = options.input;
195-
const workspacePath = parameters.workspacePath ? Uri.file(parameters.workspacePath) : undefined;
195+
const workspacePath = parameters.resourcePath ? Uri.file(parameters.resourcePath) : undefined;
196196
if (!workspacePath) {
197197
throw new Error('Invalid input: workspacePath is required');
198198
}

src/test/copilotTools.unit.test.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ suite('InstallPackageTool Tests', () => {
4646

4747
test('should throw error if workspacePath is an empty string', async () => {
4848
const testFile: IInstallPackageInput = {
49-
workspacePath: '',
49+
resourcePath: '',
5050
packageList: ['package1', 'package2'],
5151
};
5252
const options = { input: testFile, toolInvocationToken: undefined };
@@ -61,7 +61,7 @@ suite('InstallPackageTool Tests', () => {
6161
mockEnvironment.setup((x: any) => x.then).returns(() => undefined);
6262

6363
const testFile: IInstallPackageInput = {
64-
workspacePath: 'this/is/a/test/path.ipynb',
64+
resourcePath: 'this/is/a/test/path.ipynb',
6565
packageList: ['package1', 'package2'],
6666
};
6767
const options = { input: testFile, toolInvocationToken: undefined };
@@ -75,7 +75,7 @@ suite('InstallPackageTool Tests', () => {
7575

7676
test('should throw error for notebook cells', async () => {
7777
const testFile: IInstallPackageInput = {
78-
workspacePath: 'this/is/a/test/path.ipynb#cell',
78+
resourcePath: 'this/is/a/test/path.ipynb#cell',
7979
packageList: ['package1', 'package2'],
8080
};
8181
const options = { input: testFile, toolInvocationToken: undefined };
@@ -89,7 +89,7 @@ suite('InstallPackageTool Tests', () => {
8989

9090
test('should throw error if packageList passed in is empty', async () => {
9191
const testFile: IInstallPackageInput = {
92-
workspacePath: 'path/to/workspace',
92+
resourcePath: 'path/to/workspace',
9393
packageList: [],
9494
};
9595

@@ -102,7 +102,7 @@ suite('InstallPackageTool Tests', () => {
102102

103103
test('should handle cancellation', async () => {
104104
const testFile: IInstallPackageInput = {
105-
workspacePath: 'path/to/workspace',
105+
resourcePath: 'path/to/workspace',
106106
packageList: ['package1', 'package2'],
107107
};
108108

@@ -131,7 +131,7 @@ suite('InstallPackageTool Tests', () => {
131131

132132
test('should handle packages installation', async () => {
133133
const testFile: IInstallPackageInput = {
134-
workspacePath: 'path/to/workspace',
134+
resourcePath: 'path/to/workspace',
135135
packageList: ['package1', 'package2'],
136136
};
137137

@@ -162,7 +162,7 @@ suite('InstallPackageTool Tests', () => {
162162
});
163163
test('should handle package installation failure', async () => {
164164
const testFile: IInstallPackageInput = {
165-
workspacePath: 'path/to/workspace',
165+
resourcePath: 'path/to/workspace',
166166
packageList: ['package1', 'package2'],
167167
};
168168

@@ -195,7 +195,7 @@ suite('InstallPackageTool Tests', () => {
195195
});
196196
test('should handle error occurs when getting environment', async () => {
197197
const testFile: IInstallPackageInput = {
198-
workspacePath: 'path/to/workspace',
198+
resourcePath: 'path/to/workspace',
199199
packageList: ['package1', 'package2'],
200200
};
201201
mockApi
@@ -213,7 +213,7 @@ suite('InstallPackageTool Tests', () => {
213213
});
214214
test('correct plurality in package installation message', async () => {
215215
const testFile: IInstallPackageInput = {
216-
workspacePath: 'path/to/workspace',
216+
resourcePath: 'path/to/workspace',
217217
packageList: ['package1'],
218218
};
219219
mockApi

0 commit comments

Comments
 (0)