diff --git a/R/ollama.R b/R/ollama.R index 93b0a05..2c78bd6 100644 --- a/R/ollama.R +++ b/R/ollama.R @@ -170,7 +170,7 @@ generate <- function(model, prompt, suffix = "", images = "", system = "", templ #' @param tools Tools for the model to use if supported. Requires stream = FALSE. Default is an empty list. #' @param stream Enable response streaming. Default is FALSE. #' @param keep_alive The duration to keep the connection alive. Default is "5m". -#' @param output The output format. Default is "resp". Other options are "jsonlist", "raw", "df", "text", "req" (httr2_request object). +#' @param output The output format. Default is "resp". Other options are "jsonlist", "raw", "df", "text", "req" (httr2_request object), "tools" (tool calling) #' @param endpoint The endpoint to chat with the model. Default is "/api/chat". #' @param host The base URL to use. Default is NULL, which uses Ollama's default base URL. #' @param ... Additional options to pass to the model. @@ -208,7 +208,7 @@ generate <- function(model, prompt, suffix = "", images = "", system = "", templ #' list(role = "user", content = "What is in the image?", images = image_path) #' ) #' chat("benzie/llava-phi-3", messages, output = 'text') -chat <- function(model, messages, tools = list(), stream = FALSE, keep_alive = "5m", output = c("resp", "jsonlist", "raw", "df", "text", "req"), endpoint = "/api/chat", host = NULL, ...) { +chat <- function(model, messages, tools = list(), stream = FALSE, keep_alive = "5m", output = c("resp", "jsonlist", "raw", "df", "text", "req", "tools"), endpoint = "/api/chat", host = NULL, ...) { output <- output[1] if (!output %in% c("df", "resp", "jsonlist", "raw", "text", "req", "tools")) { stop("Invalid output format specified. Supported formats: 'df', 'resp', 'jsonlist', 'raw', 'text'") diff --git a/man/chat.Rd b/man/chat.Rd index bca51bf..a58412d 100644 --- a/man/chat.Rd +++ b/man/chat.Rd @@ -10,7 +10,7 @@ chat( tools = list(), stream = FALSE, keep_alive = "5m", - output = c("resp", "jsonlist", "raw", "df", "text", "req"), + output = c("resp", "jsonlist", "raw", "df", "text", "req", "tools"), endpoint = "/api/chat", host = NULL, ... @@ -27,7 +27,7 @@ chat( \item{keep_alive}{The duration to keep the connection alive. Default is "5m".} -\item{output}{The output format. Default is "resp". Other options are "jsonlist", "raw", "df", "text", "req" (httr2_request object).} +\item{output}{The output format. Default is "resp". Other options are "jsonlist", "raw", "df", "text", "req" (httr2_request object), "tools" (tool calling)} \item{endpoint}{The endpoint to chat with the model. Default is "/api/chat".}