Nothing
#' Retrieve and return model information from the Ollama API
#'
#' This function connects to the Ollama API and retrieves information
#' about available models, returning it as a data frame.
#' @return A tibble containing model information, or NULL if no models are found.
#' @param .ollama_server The URL of the ollama server to be used
#' @export
ollama_list_models <- function(.ollama_server = "http://localhost:11434") {
# Perform the request and save the response
response <- httr2::request(.ollama_server) |>
httr2::req_url_path("/api/tags") |>
httr2::req_perform() |>
httr2::resp_body_json()
# Check if 'models' key exists in the response
if (!is.null(response$models)) {
models <- response$models
# Create a data frame (or tibble if as_tibble is TRUE) with model information
model_info <- tibble::tibble(
name = sapply(models, function(model) model$name),
modified_at = sapply(models, function(model) model$modified_at),
size = sapply(models, function(model) model$size),
format = sapply(models, function(model) model$details$format),
family = sapply(models, function(model) model$details$family),
parameter_size = sapply(models, function(model) model$details$parameter_size),
quantization_level = sapply(models, function(model) model$details$quantization_level),
stringsAsFactors = FALSE
)
return(model_info)
} else {
# Return NULL if no models are found
return(NULL)
}
}
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.