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.Ping - Check Server Connection

Previous Top Next


MiniRobotLanguage (MRL)

 

LMS.Ping Command

Check Server Connection

 

Intention

 

The LMS.Ping command provides the simplest and fastest way to check if the LM Studio server is running and accessible from the script. It performs a quick health check and returns a boolean value (`1` for success, `0` for failure).

 

This is the ideal command to use at the beginning of a script to validate the connection before attempting to send any complex prompts. For more detailed diagnostics, use the LMS.Get Status command.

 

Syntax

 

LMS.Ping|P1

 

Parameter Explanation

 

P1 - (Required) The variable (e.g., $$RES) where the result will be stored. It will receive `1` if the server is online and responds correctly, or `0` if it is offline or an error occurs.

 

Example

 

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

' LMS.Ping - Sample

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

'

' Perform the connection check.

LMS.Ping|$$RES

'

' Check the result and inform the user.

IFV.$$RES |=| 1

MBX.Connection to LM Studio server was successful.

ELS.

MBX.Error: Could not connect to LM Studio server. Please ensure the server is running.

EIF.

ENR.

 

Remarks

 

This command performs a simple HTTP GET request to the server's model listing endpoint with a short timeout of 5 seconds. A successful connection (HTTP status 200) results in a `1`.

 

See also:

 

    LMS.Get Status - Get Detailed Server Status

    LMS.Set Timeout - Set the Request Timeout

    LMS.Set Url - Set the Main Chat URL