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.SetSystemPrompt - Set Agent Persona

Previous Top Next


MiniRobotLanguage (MRL)

 

LMS.Set SystemPrompt - Command

Define AI Behavior and Rules

 

Intention

 

This command sets the System Prompt (also known as the System Instruction or Persona) for the AI model.

 

The system prompt is a special message sent at the beginning of a conversation that defines:

  The AI's Role: e.g., "You are an expert programmer," "You are a helpful teacher."

  Formatting Rules: e.g., "Always reply in JSON," "Keep answers under 50 words."

  Behavioral Constraints: e.g., "Do not apologize," "Be concise."

 

Once set, this prompt is automatically applied to all subsequent calls to LMS.ask, LMS.askex, and LMS.askmcp.

 

Syntax

 

LMS.Set SystemPrompt|P1

 

Parameter Explanation

 

P1 - (Required) The text of the system instruction.

Pass an empty string ("") to clear the system prompt and return to default behavior.

 

Example

 

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

' LMS.setsystemprompt - Defining a Persona

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

'

' 1. Set the AI to be a Python Expert

LMS.setsystemprompt|"You are a Python coding expert. Only respond with code snippets, no explanations."

LMS.ask|"How do I read a file?"|$$RES

' The $$RES will contain strictly Python code.

'

' 2. Change Persona for General Chat

LMS.setsystemprompt|""

LMS.ask|"Tell me a joke."|$$RES

' The AI behaves normally again.

 

Remarks

 

The system prompt persists globally until you change it or restart the script.

When using LMS.askmcp (Agents), the system prompt is the best place to define which tools the agent should prefer or how it should format its final report.

 

See also:

 

    LMS.askex - Extended Query

    LMS.askmcp - Agent Query