Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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"
]
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ export async function activate(context: ExtensionContext): Promise<PythonEnviron

context.subscriptions.push(
registerCompletionProvider(envManagers),
registerTools('python_environment_tool', new GetEnvironmentInfoTool(api, envManagers)),
registerTools('python_install_package_tool', new InstallPackageTool(api)),
registerTools('python_environment', new GetEnvironmentInfoTool(api, envManagers)),
registerTools('python_install_package', new InstallPackageTool(api)),
commands.registerCommand('python-envs.viewLogs', () => outputChannel.show()),
commands.registerCommand('python-envs.refreshManager', async (item) => {
await refreshManagerCommand(item);
Expand Down
4 changes: 2 additions & 2 deletions src/features/copilotTools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ function BuildEnvironmentInfoContent(envInfo: EnvironmentInfo): LanguageModelTex
*/
export interface IInstallPackageInput {
packageList: string[];
workspacePath?: string;
resourcePath?: string;
}

/**
Expand Down Expand Up @@ -192,7 +192,7 @@ export class InstallPackageTool implements LanguageModelTool<IInstallPackageInpu
});

const parameters: IInstallPackageInput = options.input;
const workspacePath = parameters.workspacePath ? Uri.file(parameters.workspacePath) : undefined;
const workspacePath = parameters.resourcePath ? Uri.file(parameters.resourcePath) : undefined;
if (!workspacePath) {
throw new Error('Invalid input: workspacePath is required');
}
Expand Down
18 changes: 9 additions & 9 deletions src/test/copilotTools.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ suite('InstallPackageTool Tests', () => {

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 };
Expand All @@ -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 };
Expand All @@ -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 };
Expand All @@ -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: [],
};

Expand All @@ -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'],
};

Expand Down Expand Up @@ -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'],
};

Expand Down Expand Up @@ -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'],
};

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down