diff --git a/chat-sample/package-lock.json b/chat-sample/package-lock.json index 91af377ad..d4e84ce09 100644 --- a/chat-sample/package-lock.json +++ b/chat-sample/package-lock.json @@ -7,10 +7,9 @@ "": { "name": "chat-sample", "version": "0.1.0", - "hasInstallScript": true, "devDependencies": { "@types/node": "^20.5.9", - "@vscode/prompt-tsx": "^0.1.10-alpha", + "@vscode/prompt-tsx": "^0.2.1-alpha", "eslint": "^7.22.0", "run-script-os": "^1.1.6", "tslint": "^6.1.3", @@ -203,15 +202,6 @@ "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", "dev": true }, - "node_modules/@microsoft/tiktokenizer": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/@microsoft/tiktokenizer/-/tiktokenizer-1.0.6.tgz", - "integrity": "sha512-Vi12N9vsU9jP3L95Ji1ZNMZyEbA9zIhLQd3oUPufoPqQZsnH2UGV2e2PDp2auJr7HvuDejGznWzHPj0pIjgBWg==", - "dev": true, - "engines": { - "node": ">=18.0.0" - } - }, "node_modules/@types/node": { "version": "20.9.0", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.9.0.tgz", @@ -222,13 +212,10 @@ } }, "node_modules/@vscode/prompt-tsx": { - "version": "0.1.10-alpha", - "resolved": "https://registry.npmjs.org/@vscode/prompt-tsx/-/prompt-tsx-0.1.10-alpha.tgz", - "integrity": "sha512-iqe1XlYsmxGGle7hmMnKd4DOebjFVmQ2odgoSzCYutOzHcqMzlRPac2sNYDQLpYlvutFi0vXl+VMPg0D3uOvVA==", - "dev": true, - "dependencies": { - "@microsoft/tiktokenizer": "^1.0.6" - } + "version": "0.2.1-alpha", + "resolved": "https://registry.npmjs.org/@vscode/prompt-tsx/-/prompt-tsx-0.2.1-alpha.tgz", + "integrity": "sha512-UMpaOS0obA9HFUEuKX09RWugblENQVZ2WnoKFdLAjOpb2xujPf3QDHXvYTypZzsWcyN5xP7zzmJWwugE7YP1fA==", + "dev": true }, "node_modules/acorn": { "version": "8.11.2", diff --git a/chat-sample/package.json b/chat-sample/package.json index 4535a043c..9f512225f 100644 --- a/chat-sample/package.json +++ b/chat-sample/package.json @@ -50,15 +50,11 @@ "scripts": { "vscode:prepublish": "npm run compile", "compile": "tsc -p ./", - "watch": "tsc -watch -p ./", - "postinstall": "npm run setupTiktoken", - "setupTiktoken": "run-script-os", - "setupTiktoken:linux:darwin": "cp node_modules/@vscode/prompt-tsx/dist/base/tokenizer/cl100k_base.tiktoken out/", - "setupTiktoken:windows": "copy node_modules\\@vscode\\prompt-tsx\\dist\\base\\tokenizer\\cl100k_base.tiktoken out\\" + "watch": "tsc -watch -p ./" }, "devDependencies": { "@types/node": "^20.5.9", - "@vscode/prompt-tsx": "^0.1.10-alpha", + "@vscode/prompt-tsx": "^0.2.1-alpha", "eslint": "^7.22.0", "run-script-os": "^1.1.6", "tslint": "^6.1.3", diff --git a/chat-sample/src/extension.ts b/chat-sample/src/extension.ts index 3325b3aec..4b0e5d00c 100644 --- a/chat-sample/src/extension.ts +++ b/chat-sample/src/extension.ts @@ -1,4 +1,4 @@ -import { renderPrompt, Cl100KBaseTokenizer } from '@vscode/prompt-tsx'; +import { renderPrompt } from '@vscode/prompt-tsx'; import * as vscode from 'vscode'; import { PlayPrompt } from './play'; @@ -56,7 +56,7 @@ export function activate(context: vscode.ExtensionContext) { PlayPrompt, { userQuery: request.prompt }, { modelMaxPromptTokens: model.maxInputTokens }, - new Cl100KBaseTokenizer()); + model); const chatResponse = await model.sendRequest(messages, {}, token); for await (const fragment of chatResponse.text) {