AIG. - AI Google Gemini Integration

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

AIG. - AI Google Gemini Integration

AIG.SetTopP

Previous Top Next


MiniRobotLanguage (MRL)

 

AIG.Set TopP
Set the Top P (Nucleus Sampling) Value for AI Responses

 

Intention

 

SetTopP Command: Controlling Response Diversity
 
The SetTopP command adjusts the Top P (nucleus sampling) parameter for Google Generative AI API responses, limiting the token selection to a cumulative probability mass.

This allows you to balance diversity and coherence in the AI’s output.

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

 

What is the SetTopP Command?

 

The SetTopP command updates the AIG_TopP global variable, which defines the nucleus sampling threshold for response generation.

Values range from 0.0 (most focused) to 1.0 (most diverse). If invalid or omitted, it defaults to 0.95.

 

Why Do You Need It?

 

Adjusting Top P is essential for:

Focus: Lower values (e.g., 0.3) for concise, relevant responses.

Variety: Higher values (e.g., 0.9) for broader, more varied outputs.

Control: Fine-tune the trade-off between coherence and creativity.

 

How to Use the SetTopP Command?

 

Set the Top P value before calling AIG.Ask to shape the response diversity.

The parameter is optional; if omitted or invalid (outside 0.0–1.0), it resets to the default 0.95.

 

Example Usage

 

AIG.Set TopP|0.8

DBP.Top P set to: 0.8

AIG.Set TopP

 

In the second case, Top P reverts to the default 0.95.

 

Illustration

 

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

│ Top P         │

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

│ 0.95          │

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

Default Top P value set when no parameter is provided.

 

Syntax

 

AIG.SetTopP[|P1]

AIG.Set TopP[|P1]

 

Parameter Explanation

 

P1 - (Optional) The Top P value (0.0 to 1.0). If omitted or invalid, defaults to 0.95.

 

Example

 

AIG.Set TopP|0.6

AIG.Ask|Suggest some ideas

DBP.Ideas: $$RET

ENR.

 

Remarks

 

- Values outside 0.0–1.0 are ignored, reverting to 0.95.

- Use AIG.Get TopP to verify the current setting.

 

Limitations

 

- The effective range is 0.0 to 1.0, per Google API constraints.

- Does not validate model-specific Top P support.

 

See also:

 

AIG.Get TopP

AIG.Set Temperature

AIG.Ask

Generation Parameters