AIU. - Artificial Intelligence Utility

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > AI - Artificial Intelligence Commands > AIU. - OpenAI API > !Response Behavior Settings >

AIU. - Artificial Intelligence Utility

AIU.GetTopP

Previous Top Next


MiniRobotLanguage (MRL)

 

AIU.GetTopP
Retrieve the Current Top P (Nucleus Sampling) Value

 

Intention

 

GetTopP Command: Accessing the Current Nucleus Sampling Value
 
The GetTopP command retrieves the current Top P (nucleus sampling) value used by AIU operations, such as AIU.Chat or AIU.GenerateResponses.

This allows verification or use of the value in script logic.

It’s part of the AIU - OpenAI API suite.

 

What is the GetTopP Command?

 

The GetTopP command fetches the current Top P value, set by AIU.SetTopP or initialized to a default (typically 1.0).

The result can be stored in a variable or, if unspecified, placed on the Top of Stack (TOS).

 

Why Do You Need It?

 

Retrieving the Top P value is useful for:

Verification: Confirm the sampling setting before generating text.

Logging: Record the current Top P for debugging or auditing.

Dynamic Control: Adjust script behavior based on the sampling value.

 

How to Use the GetTopP Command?

 

The command accepts an optional parameter to store the retrieved value.

If no variable is provided, the value is pushed onto the stack. The default is set during Init_AIU() unless overridden by AIU.SetTopP.

 

Technical Details

 

- Range: 0.0 to 1.0 (inclusive), as defined by OpenAI’s API.

- Default: Typically 1.0 (full sampling), unless altered during initialization.

- Format: Returned as a string representation of the numeric value (e.g., "0.7").

For more details, see OpenAI’s official documentation: OpenAI Chat API - top_p.

 

Example Usage

 

AIU.SetTopP|0.5

AIU.GetTopP|$$TOP

DBP.Current Top P: $$TOP

AIU.GetTopP

POP.$$TOP

 

This sets Top P to 0.5 and retrieves it using both a variable and the stack.

 

Illustration

 

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

│ Top P Retrieved    │

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

│ Top P = 0.5        │

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

The current Top P value retrieved by the command.

 

Syntax

 

AIU.GetTopP[|P1]

AIU.Get_TopP[|P1]

 

Parameter Explanation

 

P1 - (Optional) The variable to store the current Top P value. If omitted, the value is placed on the Top of Stack (TOS).

 

Example

 

AIU.SetTopP|0.9

AIU.GetTopP|$$VAL

DBP.Current Top P: $$VAL

ENR.

 

Remarks

 

- Returns the value as a string (e.g., "0.9").

- Reflects the default or the last value set by AIU.SetTopP.

 

Limitations

 

- Does not validate the value’s effect on generation; only retrieves the stored setting.

- More than one parameter triggers an error.

 

See also:

 

AIU.Set_TopP

AIU.Chat

AIU.GenerateResponses

OpenAI API - top_p Parameter