Codeunit "AOAI Token"

ID 7759
Namespace: System.AI

Provides functionality to get the token count for an input according to the model family they'd be used with.

Properties

Name Value
InherentEntitlements X
InherentPermissions X
Access Public

Methods

GetGPT35TokenCount

Gets the token count for the input according to GPT3.5 models.

procedure GetGPT35TokenCount(Input: SecretText): Integer

Parameters

Name Type Description
Input SecretText

The input to get the token count for.

Returns

Type Description
Integer

The token count.

GetGPT4TokenCount

Gets the token count for the input according to GPT4 models.

procedure GetGPT4TokenCount(Input: SecretText): Integer

Parameters

Name Type Description
Input SecretText

The input to get the token count for.

Returns

Type Description
Integer

The token count.

GetAdaTokenCount

Gets the token count for the input according to embedding Ada models.

procedure GetAdaTokenCount(Input: SecretText): Integer

Parameters

Name Type Description
Input SecretText

The input to get the token count for.

Returns

Type Description
Integer

The token count.

GetDavinciTokenCount

Gets the token count for the input according to text Davinci models.

procedure GetDavinciTokenCount(Input: SecretText): Integer

Parameters

Name Type Description
Input SecretText

The input to get the token count for.

Returns

Type Description
Integer

The token count.

GetTotalServerSessionTokensConsumed

Gets the total tokens used till now for the server session. The total tokens used is aggregated for all the models. Note: this method is expected to change in future.

procedure GetTotalServerSessionTokensConsumed(): Integer

Returns

Type Description
Integer

The total token consumed for the session.

See also