AIN. - AnythingLLM AI

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

AIN. - AnythingLLM AI

AIN.GetMaxToken

Previous Top Next


MiniRobotLanguage (MRL)

 

AIN.GetMaxToken
Get the Current Maximum Token Limit

 

Intention

 

GetMaxToken Command: Retrieve Token Limit
 
The AIN.GetMaxToken command retrieves the current maximum token limit for API requests, storing it in a specified variable.

This helps manage response lengths in the AIN - AnythingLLM AI suite.

 

What is the GetMaxToken Command?

 

The AIN.GetMaxToken command returns the maximum token limit set via AIN.SetMaxToken or a default (e.g., 4096), used in requests like AIN.Ask or AIN.AskV.

It accesses the stored value (e.g., AIN_MaxToken).

 

Why Do You Need It?

 

This command is valuable for:

Configuration Check: Verify the token limit before requests.

Dynamic Adjustment: Adapt scripts based on the limit.

Debugging: Diagnose truncation issues.

 

How to Use the GetMaxToken Command?

 

Call AIN.GetMaxToken with a variable to store the current token limit. It works after AIN.SetMaxToken or with a default value.

 

Example Usage

 

AIN.SetMaxToken|2000

AIN.GetMaxToken|$$MAX

DBP.Max Tokens: $$MAX

Retrieves the token limit (e.g., "2000") into $$MAX.

 

 

 

Syntax

 

AIN.GetMaxToken|P1

 

Parameter Explanation

 

P1 - Variable to store the token limit (required), e.g., "$$MAX".

 

Example

 

AIN.SetMaxToken|1000

AIN.GetMaxToken|$$LIM

DBP.Token Limit: $$LIM

ENR.

Stores "1000" in $$LIM and displays it.

 

Remarks

 

- Returns "0" or a default (e.g., 4096) if no limit is set.

- Reflects the limit applied to the last request if dynamically updated.

 

Limitations

 

- Only retrieves the AIN system’s stored limit, not model-specific maxima.

- Does not enforce or validate the limit’s applicability.

 

See also:

 

AIN.SetMaxToken

AIN.Ask

AIN.AskV

Operations