AIX. - Grok / X - API

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > AI - Artificial Intelligence Commands > AIX. - Grok / X - API > !Response Behavior Settings >

AIX. - Grok / X - API

AIX.SetStop

Previous Top Next


MiniRobotLanguage (MRL)

 

AIX.Set Stop
Set the Stop Sequence for Response Generation

 

Intention

 

SetStop Command: Defining Response Termination
 
The Set Stop command specifies a sequence (e.g., a string or list of strings) that signals Grok to stop generating responses.

This controls the length and structure of AI output.

It’s part of the AIX - Grok / X - API suite.

 

What is the SetStop Command?

 

The Set Stop command sets the AIX_Stop global variable, which contains one or more stop sequences (e.g., "END" or ["STOP","END"]).

If no sequence is provided, it resets to an empty default, disabling stop conditions.

 

Why Do You Need It?

 

Setting a stop sequence is useful for:

Control: Limit response length or format (e.g., stop at "END").

Consistency: Ensure uniform output across multiple requests.

Automation: Trigger script actions when a stop sequence is reached.

 

How to Use the SetStop Command?

 

Provide a string or JSON array of stop sequences, stored in AIX_Stop and applied to API responses.

Check the current setting with AIX.Get Stop.

 

Example Usage

 

AIX.Set Stop|"END"

AIX.Ask|Generate a story|0

DBP.Story: $$AIX_GrokContent (stops at END)

 

The response stops when "END" is encountered.

 

Illustration

 

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

│ Stop Sequence │

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

│ "END"         │

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

Setting a stop sequence for response termination.

 

Syntax

 

AIX.SetStop[|P1]

AIX.Set Stop[|P1]

 

Parameter Explanation

 

P1 - (Optional) A string or JSON array (e.g., "END" or ["STOP","END"]) as the stop sequence. Omitting resets to empty.

 

Example

 

AIX.Set Stop|["STOP","END"]

AIX.Ask|List items|0

DBP.Items: $$AIX_GrokContent (stops at STOP or END)

ENR.

 

Remarks

 

- Applied to responses from AIX.Ask and AIX.Ask Vision.

- Multiple stop sequences are evaluated in order of appearance.

 

Limitations

 

- Stop sequences must be predefined; dynamic detection is not supported.

- Maximum number of stop sequences may be limited by the API (check documentation).

 

See also:

 

AIX.Get Stop

AIX.Ask

AIX.Set MaxToken

AIX.Get Content