Skip to main content

Calculate Token Count

Description

Use this Activity to determine the estimated token count for the specified message.

Properties

Input

  • Message – Specify the input message to calculate the token count

  • Model – Specify the model to calculate the token count

Optional

  • Use history – Specify whether to include the messages in the history of the context for calculation. By default, this is true.

  • Continue On Error - This property specifies whether the automation should continue running even when the 'Calculate Token Count' Activity throws an error. It only supports Boolean values (True, False), with the default value set to False.

note

Rest assured, this Activity does not catch an error if it's present inside the Try-Catch block and the value of the 'Continue On Error' property is set to True.

Misc

  • DisplayName – Add a display name to your Activity.
  • Private – By default, Activity will log the values of your properties inside your workflow. If private is selected, then it stops logging.

Output

  • Number Of Tokens – Calculates an approximate number of tokens based on the input message and returns the estimated count.
  • Token Text – Retrieves the original text used for calculating the token count.

Examples

1. Download Enterprise Edition Example

Calculate Token Count

2. Download Professional Edition Example

Calculate Token Count