Skip to contents

Saves an OpenAI-compatible endpoint (chat completions at base_url/chat/completions) as the own route: the same as morie_llm_config(own.url = , own.key = , own.model = ).

Usage

morie_llm_provider_set(base_url, key = NULL, model = NULL)

morie_llm_provider_show()

morie_llm_provider_unset()

Arguments

base_url

The endpoint, e.g. "http://localhost:1234/v1".

key

The API key for it (NULL for a server that needs none).

model

Optional model name to ask by default.

Value

morie_llm_provider_set() and morie_llm_provider_unset(): the settings table, invisibly; morie_llm_provider_show(): the own.* rows of it.

Examples

old <- Sys.getenv("XDG_CONFIG_HOME", unset = NA)
Sys.setenv(XDG_CONFIG_HOME = tempfile())
morie_llm_provider_set("http://localhost:1234/v1", key = NULL, model = "my-model")
morie_llm_provider_show()
#>         key                    value  source                env
#> 2   own.url http://localhost:1234/v1   saved MORIE_LLM_BASE_URL
#> 3   own.key                (not set) default  MORIE_LLM_API_KEY
#> 4 own.model                 my-model   saved    MORIE_LLM_MODEL
#>                                                                                                                                                                      help
#> 2 your own OpenAI-compatible server, e.g. http://localhost:1234/v1 (LM Studio), http://localhost:8080/v1 (llama-server -m /path/model.gguf) or https://api.example.org/v1
#> 3                                                                                                                    API key for your own server (sent as a Bearer token)
#> 4                                                                                                                                           model name on your own server
morie_llm_provider_unset()
if (is.na(old)) Sys.unsetenv("XDG_CONFIG_HOME") else Sys.setenv(XDG_CONFIG_HOME = old)