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

Previous Top Next


MiniRobotLanguage (MRL)

 

AIU.GetFrequencyPenalty
Retrieve the Current Frequency Penalty Value

 

Intention

 

GetFrequencyPenalty Command: Check Repetition Control
 
The GetFrequencyPenalty command retrieves the current frequency penalty value, which controls how much the AI avoids repeating words or phrases.

This aids in verifying or adjusting response diversity.

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

 

What is the GetFrequencyPenalty Command?

 

The GetFrequencyPenalty command returns the current frequency penalty value set by AIU.SetFrequencyPenalty, typically between -2.0 and 2.0.

The value is returned as a string and can be stored in a variable or pushed to the Top of Stack (TOS). It influences token selection, not token count or cost.

 

Why Do You Need It?

 

Retrieving the frequency penalty is valuable for:

Verification: Confirm the repetition penalty before generating responses.

Debugging: Check if repetitive output stems from the penalty setting.

Dynamic Adjustment: Adapt script logic based on the current value.

 

How to Use the GetFrequencyPenalty Command?

 

Call the command with an optional variable to store the result. If omitted, the value is placed on the stack.

The penalty affects operations like AIU.Chat, with costs based on tokens (e.g., gpt-3.5-turbo: $1.50/1M output tokens).

 

Example Usage

 

AIU.SetFrequencyPenalty|1.5

AIU.GetFrequencyPenalty|$$PEN

DBP.Frequency Penalty: $$PEN

AIU.GetFrequencyPenalty

POP.$$PEN

DBP.Penalty from Stack: $$PEN

 

Sets a penalty of 1.5 and retrieves it (returns "1.5").

 

Illustration

 

┌──────────────┬──────────────┐

│ Set Value    │ Retrieved    │

├──────────────┼──────────────┤

│ 1.5          │ 1.5          │

├──────────────┼──────────────┤

│ -0.5         │ -0.5         │

└──────────────┴──────────────┘

Illustration of retrieving different frequency penalty values.

 

Syntax

 

AIU.GetFrequencyPenalty[|P1]

AIU.Get_FrequencyPenalty[|P1]

 

Parameter Explanation

 

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

 

Example

 

AIU.SetFrequencyPenalty|-1.0

AIU.GetFrequencyPenalty|$$VAL

DBP.Frequency Penalty: $$VAL

ENR.

 

Remarks

 

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

- Reflects the last setting from AIU.SetFrequencyPenalty or the default (usually 0).

 

Limitations

 

- Only accepts zero or one parameter; extra parameters cause an error.

- Does not validate model compatibility with the penalty range.

 

See also:

 

AIU.Set_FrequencyPenalty

AIU.Chat

AIU.Get_PresencePenalty

AIU.Get_TotalTokens

Penalty Configuration