Skip to main content

Module env

Module env 

Source
Expand description

Reads Unicode provider configuration values from the process environment.

use rig_core::client::env;

let credential = env::required("OPENAI_API_KEY")?;

Enums§

EnvError
A provider’s configuration could not be read from the environment.

Functions§

optional
Read an optional environment variable. An absent variable is Ok(None); a present one that is not valid Unicode is an error, because silently ignoring it would send a request with the wrong configuration.
required
Reads a required variable, returning an error if absent or non-Unicode. Empty strings are accepted; callers validate the value.