Token Count
Controlled node
Overview
This node is used to count the number of tokens of a given text input, for a given model. The token count is important for understanding how much text you are passing into the context window of the model you are using for text generation. If the sum of your token input and maximum output exceeds the context window size, the AI Write node will not generate any output.
The model you select should match the model you are using for text generation. For details on the models available, see the AI Write node documentation.
Inputs
Input | Type | Description | Default |
---|---|---|---|
Model | Enum | The model to use for token counting. | standard |
Text | Text | The text to be counted | - |
Run | Event | Fires when the node starts running | - |
Outputs
Output | Type | Description |
---|---|---|
Count | Number | Contains the number of tokens in the text. |
Remaining | Number | The number of tokens remaining in the context window for the chosen model |
Done | Event | Fires when the node has finished |