LMS. - LM Studio Interface

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > AI - Artificial Intelligence Commands > LMS. - LM-Studio Commands >

LMS. - LM Studio Interface

LMS.SetStop - Set Stop Sequence

Previous Top Next


MiniRobotLanguage (MRL)

 

LMS.Set Stop - Command

Control Generation Termination

 

Intention

 

This command defines one or more Stop Sequences. When the AI model encounters any of these sequences during text generation, it will immediately stop generating further text.

 

This is essential for:

  Chat Simulations: Preventing the AI from writing the User's reply (e.g., stop at "User:").

  Structured Formats: Stopping generation after a closing XML tag or bracket.

 

Syntax

 

LMS.Set Stop|P1

 

Parameter Explanation

 

P1 - (String) One or more stop words separated by commas.

Example: "User:,System:"

Pass an empty string ("") to clear all stop sequences.

 

Example

 

'**********************************************

' LMS.setstop - Preventing Hallucination

'**********************************************

'

' 1. Chat Scenario

' We want the AI (Assistant) to stop before speaking for the User.

LMS.setstop|"User:"

LMS.ask|"Let's roleplay. You are a shopkeeper."|$$RES

'

' 2. Multiple Stops (e.g. for code generation)

' Stop at end of code block or special markers.

LMS.setstop|"```,</code>"

'

' 3. Clear Stop Sequence

LMS.setstop|""

 

Remarks

 

Use commas to separate multiple stop sequences. The API will stop at whichever sequence appears first.

Note that the stop sequence itself is typically excluded from the final output `$$RET` variable.

 

See also:

 

    LMS.setsystemprompt - Set Agent Persona

    LMS.ask - Basic AI Query