From 5cf78635c773210e6725e678e70116ff087411e2 Mon Sep 17 00:00:00 2001 From: Romain Francois Date: Fri, 8 Mar 2024 19:44:39 +0100 Subject: [PATCH] check --- DESCRIPTION | 4 ++-- R/chat.R | 4 +++- R/models.R | 4 +++- R/stream.R | 3 +++ man/chat.Rd | 6 ++++-- man/models.Rd | 4 +++- man/stream.Rd | 23 +++++++++++++++++++++++ 7 files changed, 41 insertions(+), 7 deletions(-) create mode 100644 man/stream.Rd diff --git a/DESCRIPTION b/DESCRIPTION index 66b0caf..efa8a50 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -17,6 +17,6 @@ Imports: httr2, purrr, tibble, - glue, stringr, - jsonlite + jsonlite, + rlang diff --git a/R/chat.R b/R/chat.R index a1df3bb..d6aaa92 100644 --- a/R/chat.R +++ b/R/chat.R @@ -42,14 +42,16 @@ print.chat_tibble <- function(x, ...) { #' Chat with the Mistral api #' #' @param text some text -#' @param which model to use. See [models()] for more information about which models are available +#' @param model which model to use. See [models()] for more information about which models are available #' @param ... ignored #' @inheritParams httr2::req_perform #' #' @return Result text from Mistral #' #' @examples +#' \dontrun{ #' chat("Top 5 R packages") +#' } #' #' @export chat <- function(text = "What are the top 5 R packages ?", model = "mistral-tiny", ..., error_call = current_env()) { diff --git a/R/models.R b/R/models.R index de7dadb..1c31275 100644 --- a/R/models.R +++ b/R/models.R @@ -18,7 +18,9 @@ check_model <- function(model, error_call = caller_env()) { #' @return A character vector with the models available in the Mistral API #' #' @examples -#' models() +#' \dontrun{ +#' models() +#' } #' #' @export models <- function(error_call = caller_env()) { diff --git a/R/stream.R b/R/stream.R index 6c521e3..2d49719 100644 --- a/R/stream.R +++ b/R/stream.R @@ -1,3 +1,6 @@ +#' stream +#' +#' @inheritParams chat #' @export stream <- function(text, model = "mistral-tiny", ..., error_call = current_env()) { check_model(model, error_call = error_call) diff --git a/man/chat.Rd b/man/chat.Rd index e9974c0..e76f9ea 100644 --- a/man/chat.Rd +++ b/man/chat.Rd @@ -14,14 +14,14 @@ chat( \arguments{ \item{text}{some text} +\item{model}{which model to use. See \code{\link[=models]{models()}} for more information about which models are available} + \item{...}{ignored} \item{error_call}{The execution environment of a currently running function, e.g. \code{caller_env()}. The function will be mentioned in error messages as the source of the error. See the \code{call} argument of \code{\link[rlang:abort]{abort()}} for more information.} - -\item{which}{model to use. See \code{\link[=models]{models()}} for more information about which models are available} } \value{ Result text from Mistral @@ -30,6 +30,8 @@ Result text from Mistral Chat with the Mistral api } \examples{ +\dontrun{ chat("Top 5 R packages") +} } diff --git a/man/models.Rd b/man/models.Rd index 39d100c..19d5e51 100644 --- a/man/models.Rd +++ b/man/models.Rd @@ -19,6 +19,8 @@ A character vector with the models available in the Mistral API Retrieve all models available in the Mistral API } \examples{ -models() +\dontrun{ + models() +} } diff --git a/man/stream.Rd b/man/stream.Rd new file mode 100644 index 0000000..a5db2af --- /dev/null +++ b/man/stream.Rd @@ -0,0 +1,23 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/stream.R +\name{stream} +\alias{stream} +\title{stream} +\usage{ +stream(text, model = "mistral-tiny", ..., error_call = current_env()) +} +\arguments{ +\item{text}{some text} + +\item{model}{which model to use. See \code{\link[=models]{models()}} for more information about which models are available} + +\item{...}{ignored} + +\item{error_call}{The execution environment of a currently +running function, e.g. \code{caller_env()}. The function will be +mentioned in error messages as the source of the error. See the +\code{call} argument of \code{\link[rlang:abort]{abort()}} for more information.} +} +\description{ +stream +}