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.SetModel - Specifies the AI Model

Previous Top Next


MiniRobotLanguage (MRL)

 

LMS.Set Model Command

Specifies the AI Model to Use

 

Intention

 

This command specifies which AI model the LM Studio server should use for all subsequent LMS.ask or LMS.askex requests.

Unlike LMS.Select Model this command will need the exact specifications, any small mistake may prevent loading of the model.
 

The model is specified by its full ID string. You must provide the exact, case-sensitive ID as reported by the server.

You can get a list of all available model IDs by using the LMS.listmodels command.

 

For a more convenient method that uses fuzzy matching, see LMS.selectmodel.

 

Syntax

 

LMS.Set Model|P1

 

Parameter Explanation

 

P1 - (Required) The exact, case-sensitive model ID string (e.g., "LM-Studio-Community/Meta-Llama-3-8B-Instruct-GGUF").

 

Example

 

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

' LMS.setmodel - Sample

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

'

' First, get the list of models into Array 7

LMS.listmodels|7

'

' Get the first model from the list

ARR.GET|7|0|$$ModelID

'

' Check if a model was found

VAR.COMPARE|$$ModelID|""|!|$$ModelFound

IF.FALSE|$$ModelFound

MBX.Stop|No models are loaded in LM Studio!

ENR.

END.IF

'

' Set the model to the first one found

LMS.setmodel|$$ModelID

MBX.Info|Set model to: $$ModelID

'

' All future "ask" commands will now use this model.

LMS.ask|"Who are you?"|$$Response

MBX.Info|$$Response

ENR.

 

Remarks

 

This setting is persistent and remains active until a new model is set. If you provide an incorrect model ID, or the model is not currently loaded on the server, subsequent LMS.ask commands will fail (often with an HTTP 404 or 500 error).

 

See also:

 

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

    LMS.List Models - Retrieves a list of all available models from the server.

    LMS.ask

    LMS.setmodelurl