Estimate tokens by character count
demo_estimate_tokensMeasures the token count of supplied text with a simple character-based estimator so results match the savings reported by manifest building and format comparison.
Instructions
Counts the tokens in a text you supply using the estimator this package ships — character count divided by four, floored — so its numbers are directly comparable with the savings reported by build_tool_manifest and compare_formats. ...
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | The exact text to measure; whitespace and characters outside ASCII count toward the total like everything else. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bias | Yes | Where this estimate is wrong, and by how much. | |
| chars | Yes | Character length of the submitted text. | |
| method | Yes | How the number was produced, stated plainly. | |
| estimated_tokens | Yes | The figure itself: characters divided by four. |