Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Model Client Docs to Mention API Key from Environment Variables #5515

Merged
merged 3 commits into from
Feb 12, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Build Agent using Model Client\n",
"## Build an Agent with a Model Client\n",
"\n",
"Let's create a simple AI agent that can respond to messages using the ChatCompletion API."
]
Expand Down Expand Up @@ -873,6 +873,23 @@
"to make the agent \"remember\" previous conversations.\n",
"See the [Model Context](./model-context.ipynb) page for more details."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## API Keys From Environment Variables\n",
"\n",
"In the examples above, we show that you can provide the API key through the `api_key` argument. Importantly, the OpenAI and Azure OpenAI clients use the [openai package](https://github.com/openai/openai-python/blob/3f8d8205ae41c389541e125336b0ae0c5e437661/src/openai/__init__.py#L260), which will automatically read an api key from the environment variable if one is not provided.\n",
"\n",
"- For OpenAI, you can set the `OPENAI_API_KEY` environment variable. \n",
victordibia marked this conversation as resolved.
Show resolved Hide resolved
"- For Azure OpenAI, you can set the `AZURE_OPENAI_API_KEY` environment variable. \n",
"\n",
"In addition, for Gemini (Beta), you can set the `GEMINI_API_KEY` environment variable.\n",
"\n",
"This is a good practice to explore, as it avoids including sensitive api keys in your code. \n",
"\n"
]
}
],
"metadata": {
Expand Down
Loading