From ceef32ef04997083fed47b35eb761e55f388a539 Mon Sep 17 00:00:00 2001 From: Don Jayamanne Date: Wed, 23 Apr 2025 11:50:03 +1000 Subject: [PATCH] Update tool names and args --- package.json | 10 +++++----- src/extension.ts | 4 ++-- src/features/copilotTools.ts | 4 ++-- src/test/copilotTools.unit.test.ts | 18 +++++++++--------- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/package.json b/package.json index 69cd4ec0..0b42bb94 100644 --- a/package.json +++ b/package.json @@ -487,7 +487,7 @@ ], "languageModelTools": [ { - "name": "python_environment_tool", + "name": "python_environment", "displayName": "Get Python Environment Information", "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.", "toolReferenceName": "pythonGetEnvironmentInfo", @@ -508,7 +508,7 @@ } }, { - "name": "python_install_package_tool", + "name": "python_install_package", "displayName": "Install Python Package", "modelDescription": "Installs Python packages in the given workspace. Use this tool to install packages in the user's chosen environment.", "toolReferenceName": "pythonInstallPackage", @@ -525,14 +525,14 @@ }, "description": "The list of packages to install." }, - "workspacePath": { + "resourcePath": { "type": "string", - "description": "Path to Python workspace that determines the environment for package installation." + "description": "The path to the Python file or workspace to get the environment information for." } }, "required": [ "packageList", - "workspacePath" + "resourcePath" ] } } diff --git a/src/extension.ts b/src/extension.ts index ff73ab26..226e4821 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -108,8 +108,8 @@ export async function activate(context: ExtensionContext): Promise outputChannel.show()), commands.registerCommand('python-envs.refreshManager', async (item) => { await refreshManagerCommand(item); diff --git a/src/features/copilotTools.ts b/src/features/copilotTools.ts index c94455ca..257d6a24 100644 --- a/src/features/copilotTools.ts +++ b/src/features/copilotTools.ts @@ -164,7 +164,7 @@ function BuildEnvironmentInfoContent(envInfo: EnvironmentInfo): LanguageModelTex */ export interface IInstallPackageInput { packageList: string[]; - workspacePath?: string; + resourcePath?: string; } /** @@ -192,7 +192,7 @@ export class InstallPackageTool implements LanguageModelTool { test('should throw error if workspacePath is an empty string', async () => { const testFile: IInstallPackageInput = { - workspacePath: '', + resourcePath: '', packageList: ['package1', 'package2'], }; const options = { input: testFile, toolInvocationToken: undefined }; @@ -61,7 +61,7 @@ suite('InstallPackageTool Tests', () => { mockEnvironment.setup((x: any) => x.then).returns(() => undefined); const testFile: IInstallPackageInput = { - workspacePath: 'this/is/a/test/path.ipynb', + resourcePath: 'this/is/a/test/path.ipynb', packageList: ['package1', 'package2'], }; const options = { input: testFile, toolInvocationToken: undefined }; @@ -75,7 +75,7 @@ suite('InstallPackageTool Tests', () => { test('should throw error for notebook cells', async () => { const testFile: IInstallPackageInput = { - workspacePath: 'this/is/a/test/path.ipynb#cell', + resourcePath: 'this/is/a/test/path.ipynb#cell', packageList: ['package1', 'package2'], }; const options = { input: testFile, toolInvocationToken: undefined }; @@ -89,7 +89,7 @@ suite('InstallPackageTool Tests', () => { test('should throw error if packageList passed in is empty', async () => { const testFile: IInstallPackageInput = { - workspacePath: 'path/to/workspace', + resourcePath: 'path/to/workspace', packageList: [], }; @@ -102,7 +102,7 @@ suite('InstallPackageTool Tests', () => { test('should handle cancellation', async () => { const testFile: IInstallPackageInput = { - workspacePath: 'path/to/workspace', + resourcePath: 'path/to/workspace', packageList: ['package1', 'package2'], }; @@ -131,7 +131,7 @@ suite('InstallPackageTool Tests', () => { test('should handle packages installation', async () => { const testFile: IInstallPackageInput = { - workspacePath: 'path/to/workspace', + resourcePath: 'path/to/workspace', packageList: ['package1', 'package2'], }; @@ -162,7 +162,7 @@ suite('InstallPackageTool Tests', () => { }); test('should handle package installation failure', async () => { const testFile: IInstallPackageInput = { - workspacePath: 'path/to/workspace', + resourcePath: 'path/to/workspace', packageList: ['package1', 'package2'], }; @@ -195,7 +195,7 @@ suite('InstallPackageTool Tests', () => { }); test('should handle error occurs when getting environment', async () => { const testFile: IInstallPackageInput = { - workspacePath: 'path/to/workspace', + resourcePath: 'path/to/workspace', packageList: ['package1', 'package2'], }; mockApi @@ -213,7 +213,7 @@ suite('InstallPackageTool Tests', () => { }); test('correct plurality in package installation message', async () => { const testFile: IInstallPackageInput = { - workspacePath: 'path/to/workspace', + resourcePath: 'path/to/workspace', packageList: ['package1'], }; mockApi