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.ListModels - Retrieve Available Models

Previous Top Next


MiniRobotLanguage (MRL)

 

LMS.List Models - Command

Retrieve Available Models

 

Intention

 

This command queries the LM Studio server (at the /v1/models endpoint) to get a list of all currently loaded and available model IDs.

 

It populates a specified SPR Array (e.g., Array 5, Array 10) with the string names of the models. This is essential for knowing which models can be set using LMS.setmodel or LMS.selectmodel.

 

Syntax

 

LMS.List Models|P1

 

Parameter Explanation

 

P1 - (Required) The numeric index (e.g., 5) of the SPR Array to populate with the list of model names.

 

Example

 

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

' LMS.listmodels - Sample

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

'

' Get all available models into SPR Array 7

LMS.listmodels|7

'

' Find out how many models were found

ARR.GETBOUNDS|7||$$ModelCount

' $$ModelCount is zero-based, so add 1 for display

VAR.MATH|ADD|$$ModelCount|1|$$ModelCount

'

' Get the first model from the list (index 0)

ARR.GET|7|0|$$FirstModel

'

MBX.Info|Found $$ModelCount models. The first one is: $$FirstModel

ENR.

 

Remarks

 

This command requires exactly one parameter: the number of the target SPR Array.

The specified array will be automatically cleared and redimensioned to hold the list of model names. If no models are found, or if the server is unreachable, the array will be empty (its upper bound will be -1).

 

See also:

 

    LMS.setmodel - Specifies the model to be used for generating responses.

    LMS.Select Model - Choose a Model using Fuzzy-Logic

    LMS.Get Status

    ARR.Delete

    ARR.GET