Skip to content

Commit 74b201f

Browse files
authored
Add AZURE_OPENAI_API_KEY to auto env vars (#514)
Signed-off-by: Igor Gitman <igitman@nvidia.com>
1 parent 2b7fd92 commit 74b201f

3 files changed

Lines changed: 15 additions & 4 deletions

File tree

docs/basics/cluster-configs.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ export WANDB_API_KEY=...
4747
export HF_TOKEN=...
4848
# only needed if running inference with OpenAI models
4949
export OPENAI_API_KEY=...
50+
# only needed if running inference with Azure OpenAI models
51+
export AZURE_OPENAI_API_KEY=...
5052
# only needed if running inference with Nvidia NIM models
5153
export NVIDIA_API_KEY=...
5254
```

nemo_skills/pipeline/setup.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,11 @@ def setup():
9696

9797
env_vars = typer.prompt(
9898
"\nYou can also specify any environment variables that you want to be accessible in containers.\n"
99-
"Can either define just the name (we take value from the current environment), or name=value to use a fixed value.\n"
100-
"By default we will always pass WANDB_API_KEY, NVIDIA_API_KEY, OPENAI_API_KEY, HF_TOKEN, so you don't need to list those.\n"
99+
"Can either define just the name (we take value from the current environment), "
100+
"or name=value to use a fixed value.\n"
101+
"By default we will always pass "
102+
"WANDB_API_KEY, NVIDIA_API_KEY, AZURE_OPENAI_API_KEY, OPENAI_API_KEY, HF_TOKEN, "
103+
"so you don't need to list those.\n"
101104
"What other environment variables would you like to define? (comma separated)",
102105
default="",
103106
)

nemo_skills/pipeline/utils/cluster.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def get_env_variables(cluster_config):
6363
- `required_env_vars` - list of required environment variables
6464
- `env_vars` - list of optional environment variables
6565
66-
WANDB_API_KEY, NVIDIA_API_KEY, OPENAI_API_KEY, and HF_TOKEN are always added if they exist.
66+
WANDB_API_KEY, NVIDIA_API_KEY, AZURE_OPENAI_API_KEY, OPENAI_API_KEY, and HF_TOKEN are always added if they exist.
6767
6868
Args:
6969
cluster_config: cluster config dictionary
@@ -101,7 +101,13 @@ def get_env_variables(cluster_config):
101101
# It is fine to have these as always optional even if they are required for some configs
102102
# Assume it is required, then this will override the value set above with the same
103103
# value, assuming it has not been updated externally between these two calls
104-
always_optional_env_vars = ["WANDB_API_KEY", "NVIDIA_API_KEY", "OPENAI_API_KEY", "HF_TOKEN"]
104+
always_optional_env_vars = [
105+
"WANDB_API_KEY",
106+
"NVIDIA_API_KEY",
107+
"AZURE_OPENAI_API_KEY",
108+
"OPENAI_API_KEY",
109+
"HF_TOKEN",
110+
]
105111
default_factories = {
106112
"HF_TOKEN": lambda: str(get_token()),
107113
}

0 commit comments

Comments
 (0)