|
<< 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 |
MiniRobotLanguage (MRL)
AIX.Set MaxToken
Set the Maximum Token Limit for Responses
Intention
Set MaxToken Command: Control Response Length
The Set MaxToken Command sets the maximum number of tokens (words or subword units) allowed in AI-generated responses, influencing the length and detail of output from the Grok model.
This helps manage response size and processing time.
It�s part of the AIX - Grok / X - API suite.
The Set MaxToken Command updates a global setting (e.g., AIX_MaxToken) that specifies the maximum token limit for responses generated by AIX.Ask and AIX.AskVision.
Tokens represent words or subword units (e.g., punctuation or partial words) as processed by the model�s tokenizer. The typical range is 1 to 4096 tokens, with a default value of 1024 tokens, though this may vary based on the Grok API�s capabilities.
Setting the maximum token limit is valuable for:
�Length Control: Limits response size to avoid overly verbose or truncated outputs.
�Performance Optimization: Reduces processing time and memory usage for large responses.
�Use Case Adaptation: Tailors response length to specific needs (e.g., brief answers vs. detailed reports).
Use the Command to set the maximum token limit before executing AI queries with AIX.Ask or AIX.AskVision.
Specify a value within the supported range (e.g., 1 to 4096) and verify with AIX.Get MaxToken to ensure the setting is applied correctly.
Example Usage
AIX.Set MaxToken|500
AIX.Ask|""Provide a brief summary of AI history""
AIX.Get MaxToken|$$LIMIT
DBP.Maximum token limit: $$LIMIT
AIX.Set MaxToken|2000
AIX.Ask|""Give a detailed explanation of AI development""
This example sets a low token limit for a brief response, verifies it, then increases the limit for a detailed response.
Illustration
+--------------------+
� Set Max Token � � ��
+--------------------�
� Input: Token Limit �
� Process: Update � ��
� Output: Setting � ��
+--------------------+
A visual of setting and updating the maximum token limit configuration.
Syntax
AIX.Set MaxToken|value
AIX_Set_MaxToken|value
Parameter Explanation
value - (Required) An integer value (e.g., 1 to 4096) of type LONG specifying the maximum number of tokens for responses. Values outside the supported range may be clamped or trigger an error.
Remarks
- The token limit is applied to responses generated by AIX.Ask and AIX.AskVision, ensuring the output does not exceed the specified length.
- The default value is typically 1024 tokens, but this can be adjusted based on the Grok API�s maximum supported limit (e.g., 4096 tokens).
Limitations
- Changes apply only to future responses; existing responses are unaffected.
- Values exceeding the Grok API�s maximum token limit (e.g., 4096) may be ignored or capped.
- The token count includes both input prompt and response tokens, which may reduce the effective response length if the prompt is long.
See also:
? AIX.Ask
? Model Configuration and Limits