Skip to content

Remove lm tools #452

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

Merged
merged 2 commits into from
May 29, 2025
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
112 changes: 1 addition & 111 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,7 @@
}
},
"activationEvents": [
"onLanguage:python",
"onLanguageModelTool:get_python_environment_info",
"onLanguageModelTool:get_python_executable_info",
"onLanguageModelTool:install_python_package",
"onLanguageModelTool:create_quick_virtual_environment"
"onLanguage:python"
],
"homepage": "https://github.com/microsoft/vscode-python-environments",
"repository": {
Expand Down Expand Up @@ -516,112 +512,6 @@
{
"type": "python"
}
],
"languageModelTools": [
{
"name": "get_python_environment_info",
"displayName": "%python.languageModelTools.get_python_environment_info.displayName%",
"userDescription": "%python.languageModelTools.get_python_environment_info.userDescription%",
"modelDescription": "This tool will retrieve the details of the Python Environment for the specified file or workspace. The details returned include the 1. Type of Environment (conda, venv, etec), 2. Version of Python, 3. List of all installed packages with their versions. ",
"toolReferenceName": "pythonEnvironmentDetails",
"tags": [
"python",
"extension_installed_by_tool"
],
"icon": "$(snake)",
"canBeReferencedInPrompt": true,
"inputSchema": {
"type": "object",
"properties": {
"resourcePath": {
"type": "string"
}
},
"description": "The path to the Python file or workspace to get the environment information for.",
"required": []
}
},
{
"name": "get_python_executable_info",
"displayName": "%python.languageModelTools.get_python_executable.displayName%",
"userDescription": "%python.languageModelTools.get_python_executable.userDescription%",
"modelDescription": "This tool will retrieve the details of the Python Environment for the specified file or workspace. ALWAYS use this tool before executing any Python command in the terminal. This tool returns the details of how to construct the fully qualified path and or command including details such as arguments required to run Python in a terminal. Note: Instead of executing `python --version` or `python -c 'import sys; print(sys.executable)'`, use this tool to get the Python executable path to replace the `python` command. E.g. instead of using `python -c 'import sys; print(sys.executable)'`, use this tool to build the command `conda run -n <env_name> -c 'import sys; print(sys.executable)'`.",
"toolReferenceName": "pythonExecutableDetails",
"tags": [
"python",
"extension_installed_by_tool"
],
"icon": "$(files)",
"canBeReferencedInPrompt": true,
"inputSchema": {
"type": "object",
"properties": {
"resourcePath": {
"type": "string"
}
},
"description": "The path to the Python file or workspace to get the executable information for. If not provided, the current workspace will be used. Where possible pass the path to the file or workspace.",
"required": []
}
},
{
"name": "install_python_package",
"displayName": "%python.languageModelTools.install_python_package.displayName%",
"userDescription": "%python.languageModelTools.install_python_package.userDescription%",
"modelDescription": "Installs Python packages in the given workspace. Use this tool to install packages in the user's chosen environment.",
"toolReferenceName": "installPythonPackage",
"tags": [
"python",
"install python package",
"extension_installed_by_tool"
],
"icon": "$(package)",
"canBeReferencedInPrompt": true,
"inputSchema": {
"type": "object",
"properties": {
"packageList": {
"type": "array",
"items": {
"type": "string"
},
"description": "The list of packages to install."
},
"resourcePath": {
"type": "string",
"description": "The path to the Python file or workspace into which the packages are installed. If not provided, the current workspace will be used. Where possible pass the path to the file or workspace."
}
},
"required": [
"packageList"
]
}
},
{
"name": "create_quick_virtual_environment",
"displayName": "Create a Virtual Environment",
"modelDescription": "This tool will create a Virual Environment",
"tags": [],
"canBeReferencedInPrompt": false,
"inputSchema": {
"type": "object",
"properties": {
"packageList": {
"type": "array",
"items": {
"type": "string"
},
"description": "The list of packages to install."
},
"resourcePath": {
"type": "string",
"description": "The path to the Python file or workspace for which a Python Environment needs to be configured."
}
},
"required": []
},
"when": "false"
}
]
},
"scripts": {
Expand Down
10 changes: 2 additions & 8 deletions package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,5 @@
"python-envs.createNewProjectFromTemplate.title": "Create New Project from Template",
"python-envs.terminal.activate.title": "Activate Environment in Current Terminal",
"python-envs.terminal.deactivate.title": "Deactivate Environment in Current Terminal",
"python-envs.uninstallPackage.title": "Uninstall Package",
"python.languageModelTools.get_python_environment_info.displayName": "Get Python Environment Info",
"python.languageModelTools.get_python_environment_info.userDescription": "Get information for a Python Environment, such as Type, Version, Packages, and more.",
"python.languageModelTools.install_python_package.displayName": "Install Python Package",
"python.languageModelTools.install_python_package.userDescription": "Installs Python packages in a Python Environment.",
"python.languageModelTools.get_python_executable.displayName": "Get Python Executable Info",
"python.languageModelTools.get_python_executable.userDescription": "Get executable info for a Python Environment"
}
"python-envs.uninstallPackage.title": "Uninstall Package"
}
22 changes: 2 additions & 20 deletions src/extension.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { commands, ExtensionContext, LogOutputChannel, Terminal, Uri, window } from 'vscode';
import { PythonEnvironment, PythonEnvironmentApi } from './api';
import { ensureCorrectVersion } from './common/extVersion';
import { registerTools } from './common/lm.apis';
import { registerLogger, traceError, traceInfo } from './common/logging';
import { setPersistentState } from './common/persistentState';
import { newProjectSelection } from './common/pickers/managers';
import { StopWatch } from './common/stopWatch';
import { EventNames } from './common/telemetry/constants';
import { sendManagerSelectionTelemetry } from './common/telemetry/helpers';
import { sendTelemetryEvent } from './common/telemetry/sender';
import { createDeferred } from './common/utils/deferred';
import {
activeTerminal,
createLogOutputChannel,
Expand Down Expand Up @@ -64,16 +64,11 @@ import { PythonStatusBarImpl } from './features/views/pythonStatusBar';
import { updateViewsAndStatus } from './features/views/revealHandler';
import { EnvironmentManagers, ProjectCreators, PythonProjectManager } from './internal.api';
import { registerSystemPythonFeatures } from './managers/builtin/main';
import { SysPythonManager } from './managers/builtin/sysPythonManager';
import { createNativePythonFinder, NativePythonFinder } from './managers/common/nativePythonFinder';
import { registerCondaFeatures } from './managers/conda/main';
import { registerPoetryFeatures } from './managers/poetry/main';
import { registerPyenvFeatures } from './managers/pyenv/main';
import { GetEnvironmentInfoTool } from './features/chat/getEnvInfoTool';
import { GetExecutableTool } from './features/chat/getExecutableTool';
import { InstallPackageTool } from './features/chat/installPackagesTool';
import { CreateQuickVirtualEnvironmentTool } from './features/chat/createQuickVenvTool';
import { createDeferred } from './common/utils/deferred';
import { SysPythonManager } from './managers/builtin/sysPythonManager';

export async function activate(context: ExtensionContext): Promise<PythonEnvironmentApi> {
const start = new StopWatch();
Expand Down Expand Up @@ -148,19 +143,6 @@ export async function activate(context: ExtensionContext): Promise<PythonEnviron
context.subscriptions.push(
shellStartupVarsMgr,
registerCompletionProvider(envManagers),
registerTools(
CreateQuickVirtualEnvironmentTool.toolName,
new CreateQuickVirtualEnvironmentTool(
api,
envManagers,
projectManager,
sysPythonManager.promise,
outputChannel,
),
),
registerTools(GetEnvironmentInfoTool.toolName, new GetEnvironmentInfoTool(api, envManagers)),
registerTools(GetExecutableTool.toolName, new GetExecutableTool(api, envManagers)),
registerTools(InstallPackageTool.toolName, new InstallPackageTool(api)),
commands.registerCommand('python-envs.terminal.revertStartupScriptChanges', async () => {
await cleanupStartupScripts(shellStartupProviders);
}),
Expand Down
96 changes: 0 additions & 96 deletions src/features/chat/createQuickVenvTool.ts

This file was deleted.

61 changes: 0 additions & 61 deletions src/features/chat/getEnvInfoTool.ts

This file was deleted.

Loading