| aisetup | R Documentation |
Adds, updates, lists, selects, or removes named AI configurations. Only the
configuration is saved by R4VN. A token supplied through tokenenv remains
in an environment variable. A token supplied directly is stored in the
system keyring when package keyring is available; otherwise it is kept only
for the current R session.
aisetup(
name = NULL,
provider = "openai",
model = NULL,
url = NULL,
token = NULL,
tokenenv = NULL,
api = NULL,
language = "vi",
prompt = NULL,
default = FALSE,
use = NULL,
list = FALSE,
clear = FALSE,
save = TRUE,
timeout = 120,
temperature = NULL,
maxtokens = 1200,
inputtokens = 3000,
overwrite = TRUE
)
name |
Configuration name, for example |
provider |
|
model |
Model identifier required by the selected service. |
url |
Full API endpoint or API base ending in |
token |
Optional API token. It is never written into the R4VN configuration file. |
tokenenv |
Optional environment-variable name containing the token. |
api |
|
language |
Default language for AI comments. Common values are |
prompt |
Optional permanent instruction added to every request using this configuration. |
default |
Logical; make this configuration the default. |
use |
Name of an existing configuration to make default. |
list |
Logical; list current configurations. |
clear |
|
save |
Logical; save the configuration for future R sessions. |
timeout |
Request timeout in seconds. |
temperature |
Optional model temperature. Leave |
maxtokens |
Maximum generated tokens. |
inputtokens |
Approximate target maximum tokens for statistical results
sent to the AI service. |
overwrite |
Logical; permit replacing an existing configuration. |
Invisibly returns the saved configuration, the configuration table,
or TRUE after a management action.
## Not run:
# Recommended: keep the token in .Renviron
# OPENAI_API_KEY=your-token
aisetup(
name = "gpt",
provider = "openai",
model = "gpt-5.6",
tokenenv = "OPENAI_API_KEY",
default = TRUE
)
# Direct token: saved securely when keyring is installed
aisetup(
name = "gpt",
provider = "openai",
model = "gpt-5.6",
token = "your-token",
default = TRUE
)
# OpenAI-compatible local or third-party service
aisetup(
name = "local",
provider = "compatible",
model = "local-model",
url = "http://localhost:11434/v1",
default = TRUE
)
aisetup(list = TRUE)
aisetup(use = "gpt")
aisetup(clear = "local")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.