AIX. - Artificial Intelligence Extended 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 Extended Utility

AIX.GetTopP

Previous Top Next


MiniRobotLanguage (MRL)

 

AIX.GetTopP
Retrieve the Current Top P Value

 

Intention

 

GetTopP Command: Access the Nucleus Sampling Setting
 
The GetTopP command retrieves the current Top P value used by the AIX framework for nucleus sampling in Grok API responses.

This allows users to verify the randomness setting for AI response generation.

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

 

What is the GetTopP Command?

 

The GetTopP command fetches the current value of the AIX_TopP global variable, which controls nucleus sampling in the Grok API.

It returns a single-precision float (0 to 1), defaulting to 1.0 if not set, and can be stored in an optional variable or pushed to the Top of Stack (TOS).

 

Why Do You Need It?

 

Retrieving the Top P value is useful for:

Verification: Confirm the current nucleus sampling setting.

Debugging: Check Top P to troubleshoot response diversity issues.

Adjustment: Retrieve the value to decide if it needs tweaking.

 

How to Use the GetTopP Command?

 

Call the command with an optional variable to store the Top P value; if omitted, it’s pushed to the stack.

The Top P value influences responses from AIX.Ask or AIX.AskVision. No additional API costs are incurred for retrieval as of March 18, 2025.

 

Example Usage

 

AIX.SetTopP|0.7

AIX.GetTopP|$$TPP

DBP.Current Top P: $$TPP

 

Sets Top P to 0.7 and retrieves it into $$TPP, displaying "Current Top P: 0.7".

 

Illustration

 

┌──────────────┬──────────────┐

│ Top P Set    │ Retrieved    │

├──────────────┼──────────────┤

│ 0.7          │ 0.7          │

├──────────────┼──────────────┤

│ (default)    │ 1.0          │

└──────────────┴──────────────┘

Illustration of retrieving Top P after setting or default state.

 

Syntax

 

AIX.GetTopP[|P1]

AIX.Get_TopP[|P1]

 

Parameter Explanation

 

P1 - (Optional) The variable where the Top P value (SINGLE) is stored. If omitted, the value is placed on the Top of Stack (TOS).

 

Example

 

AIX.GetTopP|$$VAL

DBP.Top P Value: $$VAL

AIX.GetTopP

POP.$$STA

DBP.Top P from Stack: $$STA

ENR.

 

Remarks

 

- Defaults to 1.0 if not set via AIX.SetTopP.

- Top P influences the diversity of Grok API responses when included in the JSON payload.

 

Limitations

 

- Accepts zero or one parameter; extra parameters may cause an error depending on the interpreter.

- Only retrieves the current Top P, not historical values.

 

See also:

 

AIX.Set_TopP

AIX.Get_Temperature

AIX.Ask

AIX.Ask_Vision