diff --git a/src/vs/workbench/contrib/chat/browser/tools/tools.ts b/src/vs/workbench/contrib/chat/browser/tools/tools.ts index 53320370c5a0b..024646176da8b 100644 --- a/src/vs/workbench/contrib/chat/browser/tools/tools.ts +++ b/src/vs/workbench/contrib/chat/browser/tools/tools.ts @@ -50,13 +50,10 @@ Avoid repeating existing code, instead use comments to represent regions of unch // ...existing code... Here is an example of how you should format an edit to an existing Person class: -class Person { - // ...existing code... - age: number; - // ...existing code... - getAge() { - return this.age; - } +{ + "explanation": "Add an age property to the Person class", + "filePath": "/folder/person.ts", + "code": "// ...existing code...\n class Person {\n // ...existing code...\n age: number;\n // ...existing code...\n getAge() {\n return this.age;\n }\n // ...existing code...\n }" } `; @@ -64,7 +61,7 @@ class EditTool implements IToolData, IToolImpl { readonly id = 'vscode_editFile'; readonly tags = ['vscode_editing']; readonly displayName = localize('chat.tools.editFile', "Edit File"); - readonly modelDescription = `Edit a file in the workspace. Use this tool once per file that needs to be modified, even if there are multiple changes for a file. ${codeInstructions}`; + readonly modelDescription = `Edit a file in the workspace. Use this tool once per file that needs to be modified, even if there are multiple changes for a file. Generate the "explanation" property first. ${codeInstructions}`; readonly inputSchema: IJSONSchema; constructor( @@ -75,20 +72,20 @@ class EditTool implements IToolData, IToolImpl { this.inputSchema = { type: 'object', properties: { - filePath: { - type: 'string', - description: 'An absolute path to the file to edit', - }, explanation: { type: 'string', description: 'A short explanation of the edit being made. Can be the same as the explanation you showed to the user.', }, + filePath: { + type: 'string', + description: 'An absolute path to the file to edit', + }, code: { type: 'string', description: 'The code change to apply to the file. ' + codeInstructions } }, - required: ['filePath', 'explanation', 'code'] + required: ['explanation', 'filePath', 'code'] }; }