AIX - Artificial Intelligence and X Platform Utility

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > AI - Artificial Intelligence Commands > AIX. - Grok / X - API > !Model and Endpoint Configuration >

AIX - Artificial Intelligence and X Platform Utility

AIX.Get MaxToken

Previous Top Next


MiniRobotLanguage (MRL)

 

AIX.Get MaxToken
Retrieve the Current Maximum Token Limit

 

Intention

 

Get MaxToken Command: Check Response Length Limit
 
The Get MaxToken command retrieves the current maximum token limit set for AI-generated responses, as configured by the AIX.Set MaxToken command. This limit determines the maximum length of responses in terms of tokens (words or subword units).

This is useful for verifying the configuration before querying the AI.

It’s part of the AIX - Grok / X - API suite.

 

What is the Get MaxToken Command?

 

The Get MaxToken command returns the current value of the maximum token limit, likely stored in a global variable (e.g., AIX_MaxToken), which is set by AIX.Set MaxToken.

This value represents the upper bound on the number of tokens in responses from AIX.Ask and AIX.AskVision. The typical range is 1 to 4096 tokens, with a default of 1024 tokens unless otherwise specified.

 

Why Do You Need It?

 

Retrieving the maximum token limit is useful for:

Configuration Check: Verifies the current token limit to ensure it matches the intended response length.

Dynamic Adjustment: Enables scripts to adapt based on the limit (e.g., shortening prompts if the limit is low).

Debugging: Helps identify issues if responses are unexpectedly truncated or incomplete.

 

How to Use the Get MaxToken Command?

 

Use the command to retrieve the current maximum token limit after setting it with AIX.Set MaxToken.

Store the result in a variable to use in conditional logic, display it for user feedback, or adjust subsequent queries with AIX.Ask or AIX.AskVision.

 

Example Usage

 

AIX.Set MaxToken|750

AIX.Get MaxToken|$$LIMIT

IF $$LIMIT < 1000 THEN

 DBP.Low token limit detected: $$LIMIT. Shortening prompt.

 AIX.Ask|""Summarize AI briefly""

ELSE

 DBP.Token limit sufficient: $$LIMIT

 AIX.Ask|""Provide a detailed AI history""

END IF

 

This example sets a token limit, retrieves it, and adjusts the query based on the limit value.

 

Illustration

 

┌────────────────────┐

│ Get Max Token │

├────────────────────┤

│ Input: Global Var │

│ Process: Retrieve │

│ Output: Token Value│

└────────────────────┘

A visual of retrieving the current maximum token limit value.

 

Syntax

 

AIX.Get MaxToken|$$variable

AIX_Get_MaxToken|$$variable

 

Parameter Explanation

 

$$variable - (Required) A variable (e.g., $$LIMIT) of type LONG where the current maximum token limit will be stored.

 

Remarks

 

- The token limit is set by AIX.Set MaxToken and applied to AIX.Ask and AIX.AskVision.

- The default value is 1024 tokens if not explicitly set, subject to the Grok API’s maximum limit (e.g., 4096 tokens).

 

Limitations

 

- Reflects only the current setting; does not indicate the actual token count of the last response.

- May not reflect API-level enforcement if the limit is ignored or overridden due to system constraints.

 

See also:

 

AIX.Set MaxToken

AIX.Ask

AIX.AskVision

Model Configuration and Limits