Skip to contents

R port of morie.llm.ask_multi. Unlike :func:morie_llm_ask, this accepts a pre-built messages list (each element: role/content) enabling multi-turn conversation. Streaming is not supported in the R port – this always returns a single character scalar.

Usage

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

Arguments

messages

list of role/content lists.

providers

Optional character vector forcing a specific provider ordering. When NULL the auto-detected provider is tried first, then the remaining providers in priority order.

model

Optional model identifier.

timeout

HTTP timeout in seconds.

Value

Character scalar response text.

Details

Provider fall-through order mirrors :func:morie_llm_detect_provider: ollama -> gemini -> api -> openai -> local.

Examples

# \donttest{
old <- options(morie.llm.ollama_cached = FALSE)
msgs <- list(list(role = "user", content = "hello"))
out <- try(morie_llm_ask_multi(msgs))
print(out)
#> [1] "MORIE is running in local-only mode (no LLM provider detected).\n\nAvailable capabilities without an LLM:\n  - morie list-modules        List analysis modules\n  - morie run-module <name>   Run a specific module\n  - morie pipeline --all -y   Run the full analysis pipeline\n\nEnable an LLM by setting one of GEMINI_API_KEY, LLM_API_BASE_URL + LLM_API_KEY, or OPENAI_API_KEY, or by running a local Ollama instance."
options(old)
# }