AIG. - AI Google Gemini Integration

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

AIG. - AI Google Gemini Integration

AIG.GetTopP

Previous Top Next


MiniRobotLanguage (MRL)

 

AIG.Get TopP
Retrieve Current Top P (Nucleus Sampling) Value

 

Intention

 

GetTopP Command: Checking Response Diversity Setting
 
The GetTopP command retrieves the current Top P (nucleus sampling) value used by the Google Generative AI API to control response diversity.

This helps you verify or adjust your script based on the AI’s output behavior.

It’s part of the Generation Parameters suite within AIG.

 

What is the GetTopP Command?

 

The GetTopP command fetches the current value of the AIG_TopP global variable, which sets the nucleus sampling threshold for AI responses.

You can store this value in a variable or, if no variable is specified, it will be placed on the Top of Stack (TOS).

 

Why Do You Need It?

 

Retrieving the Top P value is useful for:

Verification: Confirm the setting applied by AIG.Set TopP.

Script Logic: Adjust behavior based on the diversity level.

Debugging: Ensure the AI’s output aligns with your expectations.

 

How to Use the GetTopP Command?

 

Call this command to retrieve the current Top P value, optionally storing it in a variable.

The default is 0.95 unless modified by AIG.Set TopP.

 

Example Usage

 

AIG.Get TopP|$$TOP

DBP.Current Top P: $$TOP

AIG.Get TopP

POP.$$TOP

DBP.Top P from Stack: $$TOP

 

The returned value reflects the last set Top P or the default 0.95.

 

Illustration

 

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

│ Top P         │

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

│ 0.7           │

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

Example output after setting Top P to 0.7.

 

Syntax

 

AIG.GetTopP[|P1]

AIG.Get TopP[|P1]

 

Parameter Explanation

 

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

 

Example

 

AIG.Set TopP|0.4

AIG.Get TopP|$$TOP

DBP.Current Top P: $$TOP

ENR.

 

Remarks

 

- The default Top P is 0.95 if not previously set.

- Use this command after AIG.Set TopP to confirm the setting.

 

Limitations

 

- Only reflects the current session’s setting or default.

- Does not indicate if the value is optimal for the chosen model.

 

See also:

 

AIG.Set TopP