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

Previous Top Next


MiniRobotLanguage (MRL)

 

AIU.SetPresencePenalty
Set the Presence Penalty to Reduce Repetition

 

Intention

 

SetPresencePenalty Command: Reducing Token Repetition
 
The SetPresencePenalty command sets the presence penalty value for AIU operations, such as AIU.Chat or AIU.GenerateResponses.

Presence penalty discourages the AI from repeating tokens already present in the context, promoting diversity in generated text.

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

 

What is the SetPresencePenalty Command?

 

This command configures the presence penalty, a parameter that penalizes tokens based on their prior appearance in the input or output.

Unlike frequency penalty (which penalizes based on repetition count), presence penalty applies a flat penalty to any token that has appeared at least once, encouraging new topics or vocabulary.

 

Why Do You Need It?

 

Adjusting presence penalty is beneficial for:

Diversity: Reduce repetitive phrasing or ideas in responses.

Creativity: Encourage exploration of new content over reiteration.

Clarity: Avoid redundant text in concise outputs.

 

How to Use the SetPresencePenalty Command?

 

The command requires one parameter: a numeric value within the allowed range.

Once set, this value affects subsequent text generation operations until changed or reset via Init_AIU().

 

Technical Details

 

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

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

- Effect: Positive values (e.g., 1.0) reduce repetition; negative values (e.g., -1.0) encourage it; 0.0 is neutral.

- Interaction: Works alongside frequency penalty for fine-tuned control over repetition.

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

 

Example Usage

 

AIU.SetPresencePenalty|1.5

AIU.GetPresencePenalty|$$PEN

DBP.Presence Penalty: $$PEN

 

This sets the presence penalty to 1.5 and verifies it with AIU.GetPresencePenalty.

 

Illustration

 

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

│ Presence Penalty       │

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

│ 1.5                    │

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

The configured presence penalty value to reduce repetition.

 

Syntax

 

AIU.SetPresencePenalty|P1

AIU.Set_PresencePenalty|P1

 

Parameter Explanation

 

P1 - (Required) A numeric value between -2.0 and 2.0 specifying the presence penalty.

 

Example

 

AIU.SetPresencePenalty|0.8

AIU.Chat|Tell me about dogs|$$RES

DBP.Response with reduced repetition: $$RES

ENR.

 

Remarks

 

- Must be a valid numeric value within [-2.0, 2.0].

- Persists until modified or reset.

 

Limitations

 

- Values outside [-2.0, 2.0] may cause errors or be clamped by the API.

- Exactly one parameter is required; deviations cause an error.

 

See also:

 

AIU.Get_PresencePenalty

AIU.Chat

AIU.GenerateResponses

OpenAI API - presence_penalty