|
<< 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.setmaxretries Command
Configure the Maximum Number of Retries to LM-Studio
Intention
The LMS.setmaxretries command configures how many times the system will automatically retry a failed request to the LM Studio server. This is a crucial feature for creating robust and reliable scripts that can handle temporary network issues or server unavailability.
By default, the system retries 2 times. A retry is triggered by transient errors like timeouts, server-side errors (HTTP 5xx), or when the server is temporarily busy (rate limiting). Setting this value to `0` will disable the retry mechanism. Calling the command without a parameter restores the default setting.
Syntax
LMS.Set Max Retries|[P1]
Parameter Explanation
P1 - (Optional) An integer specifying the number of times to retry a failed request.
A value of `0` disables all retries. If this parameter is omitted, the retry count is reset to the default value of 2.
Example
'**********************************************
' LMS.setmaxretries - Sample
'**********************************************
'
' Increase the number of retries for a potentially unstable connection.
LMS.setmaxretries|5
PRT.Max retries set to 5.
'
' Disable retries completely for immediate failure feedback.
LMS.setmaxretries|0
PRT.Retries are now disabled.
'
' Reset the number of retries to the default value.
LMS.setmaxretries
PRT.Max retries reset to default.
ENR.
Remarks
The default value for maximum retries is 2. The command uses an exponential backoff strategy, meaning it waits a progressively longer time between each retry to avoid overwhelming the server.
See also:
• LMS.settimeout - Set the Request Timeout
• LMS.ping - Check Server Connection
• LMS.askex - Extended AI Query