| mdask | R Documentation |
Sends a question through rmoriebricklayer::llmask(),
to a language model you bring: an OpenAI-compatible endpoint of your own,
a provider whose key is set (OpenAI, Anthropic, Google Gemini, OpenRouter,
Groq, Mistral and more: rmoriebricklayer::llmprvd()),
or an Ollama server. Nothing is sent anywhere you did not set up.
The model is given every function of rmoriedata and rmoriebricklayer and
tools to read their help, and this package's catalogue of datasets, so it
can name the tables and write the code that loads them.
rmoriebricklayer::llmstat() shows which route would
answer; mdllmconf() (or rmbl config setup
from the shell) saves a provider's key, the route and the model.
mdask(question, model = NULL, route = NULL)
question |
Character scalar. |
model |
Optional model name; the route's model when |
route |
|
Character scalar: the answer, or a sentence saying what went wrong or what to set up (never an error, so a script keeps going).
## Not run:
# These need a language model: a provider's key, Ollama, or your own server.
Sys.setenv(ANTHROPIC_API_KEY = "...")
mdask("which bundled datasets cover Toronto police use-of-force?")
mdask("summarise the SIU director's-report corpus", route = "ollama",
model = "qwen3:8b")
## End(Not run)
# With no route set up the call returns a setup hint, not an error, and
# reaches no network:
if ("llmstat" %in% getNamespaceExports("rmoriebricklayer")) {
old <- Sys.getenv(c("OLLAMA_HOST", "MORIE_LLM_BASE_URL"), unset = NA)
Sys.setenv(OLLAMA_HOST = "off", MORIE_LLM_BASE_URL = "off")
if (!nrow(subset(rmoriebricklayer::llmstat(),
status %in% c("key set", "configured")))) {
cat(mdask("hello"))
}
for (v in names(old)) {
if (is.na(old[[v]])) Sys.unsetenv(v) else do.call(Sys.setenv, as.list(old[v]))
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.