Skip to content

Commit be2b902

Browse files
...
1 parent d8cfe78 commit be2b902

File tree

3 files changed

+16
-11
lines changed

3 files changed

+16
-11
lines changed

R/chat.R

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,13 @@
99
#' if this is a `dry_run`
1010
#'
1111
#' @examples
12-
#' chat("Top 5 R packages", dry_run = TRUE)
12+
#'
13+
#' \dontrun{
14+
#' chat("Top 5 R packages")
15+
#' }
1316
#'
1417
#' @export
15-
chat <- function(messages, model = "mistral-tiny", .., error_call = current_env()) {
18+
chat <- function(messages, model = "mistral-tiny", ..., error_call = current_env()) {
1619
check_dots_empty(call = error_call)
1720

1821
req <- req_chat(messages, model = model, error_call = error_call)
@@ -37,7 +40,7 @@ req_chat <- function(messages, model = "mistral-tiny", stream = FALSE, ..., erro
3740

3841
request(mistral_base_url) |>
3942
req_url_path_append("v1", "chat", "completions") |>
40-
authenticate(error_call = error_call)
43+
authenticate(error_call = error_call) |>
4144
req_body_json(
4245
list(
4346
model = model,

R/stream.R

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@ stream <- function(messages, model = "mistral-tiny", ..., error_call = current_e
66
check_dots_empty(call = error_call)
77

88
messages <- as_messages(messages)
9-
req <- req_chat(messages, model, stream = TRUE, error_call = error_call) |>
10-
req_perform_stream(
11-
callback = stream_callback, round = "line", buffer_kb = 0.01
12-
)
9+
req <- req_chat(messages, model, stream = TRUE, error_call = error_call)
10+
11+
resp <- req_perform_stream(req, callback = stream_callback, round = "line", buffer_kb = 0.01)
1312

1413
invisible(resp)
1514
}

man/chat.Rd

Lines changed: 7 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)