tests/testthat/helper-skips.R

skip_if_no_lms <- function() {
  if (!has_lms()) {
    testthat::skip("LM Studio CLI is not installed.")
  }
}

skip_if_no_server <- function() {
  if (!is_server_running()) {
    testthat::skip("LM Studio local server is not running.")
  }
}

# The loaded embedding models, as list_models() returns them. The calling test
# skips when `model` is not among them. An error from list_models() is not
# caught, so a server that answers but rejects the list fails the test rather
# than skipping it.
loaded_embedding_models <- function(model, detailed = FALSE) {
  models <- list_models(
    loaded = TRUE,
    type = "embedding",
    detailed = detailed,
    quiet = TRUE
  )
  if (!model %in% models$key) {
    testthat::skip(paste(model, "is not loaded."))
  }
  models
}

Try the rlmstudio package in your browser

Any scripts or data that you put into this service are public.

rlmstudio documentation built on Dec. 1, 2026, 9:07 a.m.