|
<< 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 Ex - Command
Ask with Extended Options
Intention
While LMS.ask is perfect for simple queries, LMS.askex (ask-extended) provides advanced capabilities for deeper insight and debugging. It is the power-user command for complex interactions, allowing you to capture not only the final answer but also the model's intermediate reasoning and the raw server data.
This command can return three distinct pieces of information:
• The Final Answer: The cleaned, user-facing response.
• Thinking Content: The model's step-by-step reasoning, observations, and internal monologue. This is invaluable for debugging prompts and building agent-like scripts.
• Raw JSON: The complete, unmodified JSON response from the LM Studio server, useful for troubleshooting or custom data extraction.
Syntax
LMS.Ask Ex|P1|[P2]|[P3]|[P4]|[P5]
Parameter Explanation
P1 - (Required) The text prompt to send to the model.
P2 - (Optional) The full file path to an image for multimodal queries.
P3 - (Optional) The variable to store the final, cleaned answer. If this parameter is omitted or empty, the answer is sent to the clipboard.
P4 - (Optional) The variable to store the model's thinking and reasoning content.
P5 - (Optional) The variable to store the complete, raw JSON response from the server.
Example
'**********************************************
' LMS.askex - Full featured sample
'**********************************************
'
$$PRM = "What is the capital of Canada? Explain how you found the answer."
' We will skip P2 (image_path) and capture all three output types.
LMS.askex|$$PRM||$$ANS|$$THK|$$RAW
'
MBX.Final Answer (P3): $$ANS
MBX.Model's Thinking (P4): $$THK
' The raw JSON is often very long, so let's just show a snippet.
STR.left|$$RAW|200|$$SNIP
MBX.Raw JSON (P5) start: $$SNIP
ENR.
Remarks
The order of parameters is important: all inputs (P1, P2) come before all outputs (P3, P4, P5).
You can omit any of the optional parameters by leaving them empty. For example, to get only the final answer and the raw JSON, you would use `LMS.askex|P1||P3||P5`.
Limitations:
The availability of "thinking" content in P4 depends entirely on the AI model being used. Some models may not provide this information, in which case the `$$THINK_VAR` will be empty.
See also:
• LMS.selectmodel - Find and Set a Model Intelligently
• LMS.settimeout - Set the Request Timeout