AIG. - AI Google Gemini Integration

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > AI - Artificial Intelligence Commands > AIG. - Google AI > 4. Configuration (Generation Parameters) >

AIG. - AI Google Gemini Integration

AIG.SetStop

Previous Top Next


MiniRobotLanguage (MRL)

 

AIG.SetStop
Set Stop Sequences for Response Generation

 

Intention

 

Define one or more sequences of characters that, if generated by the AI model, will cause the generation process to stop immediately. This is useful for ensuring the response doesn't continue past a desired point or generate unwanted boilerplate.

 

What is the SetStop Command?

 

This Command sets the AIG_Stop global variable with a comma-separated string containing the desired stop sequences. The Google Gemini API supports up to 5 stop sequences; this library currently processes and sends up to the first 4 provided.

 

If you provide an empty string ("") or omit the parameter, the stop sequences setting is cleared, reverting to the default behavior (no custom stop sequences).

 

Why Do You Need It?

 

Use stop sequences to:

Control Response Length: Prevent the model from rambling or generating excessive text.

Enforce Structure: Stop generation when a specific marker or keyword (like "END", "---", or a specific character) appears.

Mimic Conversational Turns: Stop when the model might start generating text for the "user" role again (e.g., stop at "User:").

 

How to Use

 

Provide a single string containing the desired stop sequences, separated by commas, as parameter P1. Leading/trailing whitespace around each sequence will be trimmed. Up to 4 sequences are supported.

 

Example Usage

 

// Stop if the model generates a newline or the word "STOP"

AIG.SetStop|\n,STOP

DBP. Stop sequences set.

 

// Example with spaces that will be trimmed

AIG.SetStop| END , User: , ---

DBP. Stop sequences set to: END,User:,---

 

// Clear stop sequences (reset to default)

AIG.SetStop|""

DBP. Stop sequences cleared.

 

Syntax

 

AIG.SetStop|P1

AIG.sst|P1

 

Parameter Explanation

 

P1 - (Optional) A string containing up to 4 stop sequences, separated by commas.
� �- Example: `"\n,User:,STOP"`
� �- If an empty string (`""`) is provided or the parameter is omitted, custom stop sequences are disabled (resets to default).

 

Remarks

 

- The stop sequences are case-sensitive.

- The library currently limits input to the first 4 sequences provided in the comma-separated string.

- Use AIG.GetStop to retrieve the currently configured sequences.

 

See also:

 

? AIG.GetStop

? AIG. Commands Overview