| lang_use | R Documentation |
Specifies the back-end provider and model to use during the current R session. The target language is not processed by the function, as in converting "english" to "en" for example. The value is passed directly to the LLM, and it lets the LLM interpret the target language.
lang_use(
backend = NULL,
model = NULL,
.cache = NULL,
.lang = NULL,
.context_size = NULL,
.silent = FALSE,
...
)
backend |
"ollama" or an |
model |
The name of model supported by the back-end provider |
.cache |
Character path where translations are cached. Set to |
.lang |
Target language to translate to. This will override values found in the LANG and LANGUAGE environment variables. |
.context_size |
Maximum number of words for the context summary
included with each translation request. Set to |
.silent |
Boolean flag that controls whether there is output to the console. Defaults to FALSE. |
... |
Additional arguments that this function will pass down to the
integrating function. In the case of Ollama, it will pass those arguments to
|
Invisibly returns NULL. Prints the current configuration to the
console.
## Not run:
# Requires an interactive session with Ollama or another LLM provider
library(lang)
# Using an `ellmer` chat object
lang_use(ellmer::chat_openai(model = "gpt-4o"))
# Using Ollama directly
lang_use("ollama", "llama3.2", seed = 100)
# Turn off cache by setting `.cache` to ""
lang_use("ollama", "llama3.2", seed = 100, .cache = "")
# Use `.lang` to set the target language to translate to,
# it will be set for the current R session
lang_use("ollama", "llama3.2", .lang = "spanish")
# Use `.silent` to avoid console output
lang_use("ollama", "llama3.2", .lang = "spanish", .silent = TRUE)
# To see current settings, simply call the function
lang_use()
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.