Skip to content

Optimize token limit documentation and minor bug fixes#130

Merged
ultmaster merged 9 commits intomainfrom
token-limit-opt
Aug 23, 2025
Merged

Optimize token limit documentation and minor bug fixes#130
ultmaster merged 9 commits intomainfrom
token-limit-opt

Conversation

@ultmaster
Copy link
Contributor

No description provided.

Copilot AI review requested due to automatic review settings August 22, 2025 10:16

This comment was marked as outdated.

@ultmaster ultmaster requested a review from Copilot August 23, 2025 06:45
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR optimizes token limit functionality and addresses various bug fixes across the codebase. The changes focus on improving performance for tokenization operations, updating documentation for experimental features, and fixing several minor issues.

  • Updates default tokenizer model from gpt-3.5-turbo to gpt-4o across the codebase
  • Adds experimental whitespace control and token/character limit parameters to text components
  • Implements performance optimizations for token counting using byte-count heuristics

Reviewed Changes

Copilot reviewed 24 out of 25 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
python/poml/_tags.py Adds experimental whitespace and token control parameters to text and inline functions
packages/poml/writer.ts Optimizes token limit checking with byte-count heuristics and updates default model
packages/poml/tests/index.test.tsx Adds comprehensive tests for whitespace control and token limit features
packages/poml/tests/base.test.tsx Updates parameter validation tests for new experimental attributes
packages/poml/essentials.tsx Updates JSDoc comments for experimental features and adds new parameters
packages/poml/base.tsx Fixes whitespace trimming logic to handle edge cases properly
packages/poml/assets/componentDocs.json Updates component documentation with experimental feature descriptions
packages/poml-vscode/panel/types.ts Adds evaluation message types for improved debugging
packages/poml-vscode/lsp/server.ts Replaces console logging with structured notification system
packages/poml-vscode/extension.ts Implements output channel for evaluation results
packages/poml-vscode/command/testCommand.ts Minor formatting improvement in conditional logic
mkdocs.yml Restructures documentation navigation and adds new sections
examples/expects/301_generate_poml.txt Removes extra blank lines for cleaner output
docs/* Multiple documentation updates including new whitespace and token control guides

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +215 to +222
let trimmed = child;
if (index === 0) {
trimmed = trimmed.trimStart();
}
if (index === flattenedChildren.length - 1) {
trimmed = trimmed.trimEnd();
}
return trimmed;
Copy link

Copilot AI Aug 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable trimmed is declared but the original child parameter is not being used for the trimming operations. This could lead to unexpected behavior where the trimming operations are applied to a copy but the modifications don't affect the actual string being processed.

Suggested change
let trimmed = child;
if (index === 0) {
trimmed = trimmed.trimStart();
}
if (index === flattenedChildren.length - 1) {
trimmed = trimmed.trimEnd();
}
return trimmed;
let result = child;
if (index === 0) {
result = result.trimStart();
}
if (index === flattenedChildren.length - 1) {
result = result.trimEnd();
}
return result;

Copilot uses AI. Check for mistakes.
@ultmaster ultmaster merged commit 212ddb0 into main Aug 23, 2025
7 checks passed
@ultmaster ultmaster deleted the token-limit-opt branch August 27, 2025 00:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants