Skip to content

Commit

Permalink
Fixes #85 (#88)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexdima authored Sep 18, 2024
1 parent 18bace5 commit 40907a3
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vscode/prompt-tsx",
"version": "0.2.9-alpha",
"version": "0.2.10-alpha",
"description": "Declare LLM prompts with TSX",
"main": "./dist/base/index.js",
"types": "./dist/base/index.d.ts",
Expand Down
8 changes: 4 additions & 4 deletions src/base/promptRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -511,11 +511,11 @@ async function computeTokensConsumedByLiterals(tokenizer: ITokenizer, element: Q

if (isChatMessagePromptElement(instance)) {
tokensConsumed += await tokenizer.countMessageTokens({ role: element.props.role, content: '', ...(element.props.name ? { name: element.props.name } : undefined) });
}

for (const piece of pieces) {
if (piece.kind === 'literal') {
tokensConsumed += await tokenizer.tokenLength(piece.value);
}
for (const piece of pieces) {
if (piece.kind === 'literal') {
tokensConsumed += await tokenizer.tokenLength(piece.value);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/base/test/renderer.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1129,7 +1129,7 @@ LOW MED 00 01 02 03 04 05 06 07 08 09
);
})

test.skip('none-grow, greedy-grow, grow elements, nested', async () => {
test('none-grow, greedy-grow, grow elements, nested', async () => {

class StringEchoBudget extends PromptElement<IProps, number> {
prepare(sizing: PromptSizing): Promise<number> {
Expand Down

0 comments on commit 40907a3

Please sign in to comment.