Optimize token limit documentation and minor bug fixes#130
Conversation
There was a problem hiding this comment.
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-turbotogpt-4oacross 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.
| let trimmed = child; | ||
| if (index === 0) { | ||
| trimmed = trimmed.trimStart(); | ||
| } | ||
| if (index === flattenedChildren.length - 1) { | ||
| trimmed = trimmed.trimEnd(); | ||
| } | ||
| return trimmed; |
There was a problem hiding this comment.
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.
| 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; |
No description provided.