AIG. - AI Google Gemini Integration

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

AIG. - AI Google Gemini Integration

AIG.SetTemperature

Previous Top Next


MiniRobotLanguage (MRL)

 

AIG.Set Temperature
Set the Temperature Parameter for AI Responses

 

Intention

 

SetTemperature Command: Controlling Response Creativity
 
The SetTemperature command adjusts the sampling temperature for Google Generative AI API responses, influencing the randomness and creativity of the output.

This allows you to fine-tune the AI’s behavior for your specific use case.

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

 

What is the SetTemperature Command?

 

The SetTemperature command updates the AIG_Temperature global variable, which controls the randomness of the AI’s responses.

Values range from 0.0 (more deterministic) to 2.0 (more creative). If invalid or omitted, it defaults to 1.0.

 

Why Do You Need It?

 

Adjusting the temperature is crucial for:

Precision: Lower values (e.g., 0.5) for factual, predictable responses.

Creativity: Higher values (e.g., 1.5) for diverse, imaginative outputs.

Task Suitability: Match response style to your application’s needs.

 

How to Use the SetTemperature Command?

 

Set the temperature before calling AIG.Ask to influence the response.

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

 

Example Usage

 

AIG.Set Temperature|0.7

DBP.Temperature set to: 0.7

AIG.Set Temperature

 

In the second case, the temperature reverts to the default 1.0.

 

Illustration

 

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

│ Temperature   │

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

│ 1.0           │

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

Default temperature set when no parameter is provided.

 

Syntax

 

AIG.SetTemperature[|P1]

AIG.Set Temperature[|P1]

 

Parameter Explanation

 

P1 - (Optional) The temperature value (0.0 to 2.0). If omitted or invalid, defaults to 1.0.

 

Example

 

AIG.Set Temperature|1.2

AIG.Ask|Write a creative story

DBP.Story: $$RET

ENR.

 

Remarks

 

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

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

 

Limitations

 

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

- Does not validate model-specific temperature support.

 

See also:

 

AIG.Get Temperature

AIG.Set TopP

AIG.Ask

Generation Parameters