Skip to contents

Sends messages (each list(role = , content = ), role "system", "user" or "assistant") as it is, through rmoriebricklayer::bricklayer_llm_chat(), for chat loops. When no model answers on the automatic route the result is the fallback text of morie_llm_ask.

Usage

morie_llm_ask_multi(messages, providers = NULL, model = NULL, timeout = 120)

Arguments

messages

List of role/content lists.

providers

Optional route (a character vector: the first that is not "local" is used; "api" is "own").

model

Optional model name.

timeout

Seconds to wait for the reply.

Value

Character scalar response text.

Examples

old <- Sys.getenv(c("OLLAMA_HOST", "XDG_CONFIG_HOME"), unset = NA)
Sys.setenv(OLLAMA_HOST = "off", XDG_CONFIG_HOME = tempfile())
out <- morie_llm_ask_multi(list(list(role = "user", content = "hello")))
isTRUE(attr(out, "fallback"))
#> [1] TRUE
for (v in names(old)) if (is.na(old[[v]])) Sys.unsetenv(v) else do.call(Sys.setenv, as.list(old[v]))