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.GetPresencePenalty

Previous Top Next


MiniRobotLanguage (MRL)

 

AIU.GetPresencePenalty
Retrieve the Current Presence Penalty Value

 

Intention

 

GetPresencePenalty Command: Accessing the Current Repetition Penalty
 
The GetPresencePenalty command retrieves the current presence penalty value used by AIU operations, such as AIU.Chat or AIU.GenerateResponses.

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

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

 

What is the GetPresencePenalty Command?

 

The GetPresencePenalty command fetches the current presence penalty value, set by AIU.SetPresencePenalty or initialized to a default (typically 0.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 presence penalty value is useful for:

Verification: Confirm the penalty setting before generating text.

Debugging: Log the penalty value for troubleshooting.

Dynamic Control: Adjust script behavior based on the repetition penalty.

 

How to Use the GetPresencePenalty 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.SetPresencePenalty.

 

Technical Details

 

- Range: -2.0 to 2.0 (inclusive), as per OpenAI’s API.

- Default: 0.0 (no penalty), unless altered during initialization.

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

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

 

Example Usage

 

AIU.SetPresencePenalty|1.0

AIU.GetPresencePenalty|$$PEN

DBP.Current Presence Penalty: $$PEN

AIU.GetPresencePenalty

POP.$$PEN

 

This sets the presence penalty to 1.0 and retrieves it using both a variable and the stack.

 

Illustration

 

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

│ Presence Penalty       │

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

│ 1.0                    │

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

The current presence penalty value retrieved by the command.

 

Syntax

 

AIU.GetPresencePenalty[|P1]

AIU.Get_PresencePenalty[|P1]

 

Parameter Explanation

 

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

 

Example

 

AIU.SetPresencePenalty|-0.5

AIU.GetPresencePenalty|$$VAL

DBP.Current Presence Penalty: $$VAL

ENR.

 

Remarks

 

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

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

 

Limitations

 

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

- More than one parameter triggers an error.

 

See also:

 

AIU.Set_PresencePenalty

AIU.Chat

AIU.GenerateResponses

OpenAI API - presence_penalty