Send a prompt to a locally running LM Studio model. This wrapper automatically routes your request to the appropriate subfunction based on the selected API type.
lms_chat(
model,
input,
system_prompt = NULL,
host = "http://localhost:1234",
api_type = c("openresponses", "openai", "native"),
logprobs = FALSE,
simplify = TRUE,
...
)Depending on the arguments provided:
If simplify = FALSE, returns a parsed list of the raw JSON response.
If simplify = TRUE and logprobs = FALSE, returns a single character string containing the model's text response.
If simplify = TRUE and logprobs = TRUE (and the chosen API type supports it), returns an object of class lms_chat_result containing both the text and a data.frame of token probabilities.
Character. The name of the loaded model.
Character. The user prompt to send to the model.
Character. An optional system prompt to guide model behavior.
Character. The base URL of the LM Studio server. Default is "http://localhost:1234".
Character. The LM Studio API endpoint to use. Options are "openresponses" (default), "openai", or "native".
Logical. Whether to return the log probabilities of the generated tokens. Default is FALSE.
Logical. If TRUE, extracts the core text response. Default is TRUE.
Additional arguments passed to the selected API body.