Skip to content

Commit

Permalink
Use standad userdata cells
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkDaoust committed May 30, 2024
1 parent 93fd1d5 commit c19ab8a
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
12 changes: 11 additions & 1 deletion quickstarts/Authentication.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,17 @@
"You'll call `genai.configure` with your API key, but instead of pasting your key into the notebook, you'll read it from Colab Secrets."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "562d43a97709"
},
"outputs": [],
"source": [
"import google.generativeai as genai"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand All @@ -139,7 +150,6 @@
},
"outputs": [],
"source": [
"import google.generativeai as genai\n",
"from google.colab import userdata\n",
"\n",
"GOOGLE_API_KEY=userdata.get('GOOGLE_API_KEY')\n",
Expand Down
13 changes: 11 additions & 2 deletions quickstarts/System_instructions.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,17 @@
"To run the following cell, your API key must be stored it in a Colab Secret named `GOOGLE_API_KEY`. If you don't already have an API key, or you're not sure how to create a Colab Secret, see the [Authentication](https://github.com/google-gemini/cookbook/blob/main/quickstarts/Authentication.ipynb) quickstart for an example."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "6872bcb201d3"
},
"outputs": [],
"source": [
"import google.generativeai as genai"
]
},
{
"cell_type": "code",
"execution_count": 4,
Expand All @@ -93,8 +104,6 @@
"outputs": [],
"source": [
"from google.colab import userdata\n",
"import google.generativeai as genai\n",
"\n",
"genai.configure(api_key=userdata.get(\"GOOGLE_API_KEY\"))"
]
},
Expand Down
2 changes: 1 addition & 1 deletion quickstarts/rest/Safety_REST.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
},
"outputs": [],
"source": [
"os.environ['UNSAFE_PROMPT'] = "
"os.environ['UNSAFE_PROMPT'] = \"<UNSAFE_PROMPT>\""
]
},
{
Expand Down

0 comments on commit c19ab8a

Please sign in to comment.