|
<< Click to Display Table of Contents >> Navigation: 3. Script Language > AI - Artificial Intelligence Commands > LMS. - LM-Studio Commands > LMS. - LM Studio Interface |
MiniRobotLanguage (MRL)
LMS.ask Command
Query an AI Model
Intention
The LMS.ask command is the simplest and most direct way to send a prompt to the AI model running in LM Studio. It is designed for straightforward questions and can handle both text-only and multimodal (text with an image) queries.
A key feature is its flexible output: you can either store the AI's response in a variable or have it sent directly to the clipboard. Sending to the clipboard is the recommended method for responses that may contain special characters, code, or non-English languages, as it preserves the original Unicode formatting perfectly.
Syntax
LMS.Ask|P1|[P2]|[P3]
Parameter Explanation
P1 - (Required) The text prompt or question to send to the AI model. This can be a literal string or a variable.
P2 - (Optional) The variable to store the AI's response (e.g., $$ANS). If this parameter is omitted or left empty, the response will be sent directly to the system clipboard.
P3 - (Optional) The full file path to an image. If provided, the command sends both the text and the image to a vision-capable model.
Example
'**********************************************
' Sample 1: Storing result in a variable
'**********************************************
$$PRM = "What are the primary colors?"
LMS.ask|$$PRM|$$ANS
MBX.The model answered: $$ANS
ENR.
'**********************************************
' Sample 2: Sending Unicode result to clipboard
'**********************************************
$$PRM = "Provide a code snippet in Python to print 'hello world'."
' P2 is omitted, so the formatted code goes to the clipboard.
LMS.ask|$$PRM
MBX.The code snippet has been copied to the clipboard.
ENR.
Remarks
Unicode vs. ANSI Output:
When the result is sent to a variable (P2), it is converted from Unicode to an ANSI string. This process may cause a loss of data or corruption of special characters (e.g., emojis, mathematical symbols, non-Latin alphabets). For responses containing code, foreign languages, or complex symbols, it is highly recommended to omit P2 and send the output directly to the clipboard to preserve the full, original Unicode content.
Limitations:
This command can only retrieve the final, cleaned answer from the model. It cannot access the model's intermediate "thinking" process or the raw server response. For those advanced features, you must use the LMS.askex command.
See also:
• LMS.askex - Extended AI Query
• LMS.selectmodel - Find and Set a Model Intelligently
• LMS.setmodel - Set Model by Exact Name
• LMS.ping - Check Server Connection
• LMS.setclipboard - Control Clipboard Output