From 071e39951f8dc17717ca4df10decf6cb6a1c5f39 Mon Sep 17 00:00:00 2001 From: Rob Lourens Date: Tue, 22 Oct 2024 11:59:19 -0700 Subject: [PATCH] Fix `countMessageTokens` (#123) * Fix * Version bump --- package.json | 2 +- src/base/tokenizer/tokenizer.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index b8f19ed..f0d6db3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@vscode/prompt-tsx", - "version": "0.3.0-alpha.9", + "version": "0.3.0-alpha.10", "description": "Declare LLM prompts with TSX", "main": "./dist/base/index.js", "types": "./dist/base/index.d.ts", diff --git a/src/base/tokenizer/tokenizer.ts b/src/base/tokenizer/tokenizer.ts index a243029..9267159 100644 --- a/src/base/tokenizer/tokenizer.ts +++ b/src/base/tokenizer/tokenizer.ts @@ -36,7 +36,7 @@ export class AnyTokenizer implements ITokenizer { const vscode = require('vscode'); return this.countTokens({ role: this.toChatRole(message.role), - content: vscode.LanguageModelTextPart(message.content), + content: new vscode.LanguageModelTextPart(message.content), name: 'name' in message ? message.name : undefined, }); }