Skip to contents

Resolves the API key, model and base URL used for equivalent-mutant detection. Each field is resolved independently, with this precedence (highest first):

Usage

get_openai_config(dir = getwd())

Arguments

dir

Directory to search for a .openai_config file. Only this directory is consulted (parent directories are not). Defaults to the current working directory; pass NULL to ignore config files.

Value

A list with elements api_key, model and base_url.

Details

  1. values set with set_openai_config();

  2. a .openai_config file in dir (a human-readable "field: value" file that is parsed, never executed);

  3. the environment variables OPENAI_API_KEY, OPENAI_MODEL and OPENAI_BASE_URL;

  4. built-in defaults (model "gpt-4", the public OpenAI base URL).

Examples

config <- get_openai_config()
names(config)
#> [1] "api_key"  "model"    "base_url"