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

Run nbfmt on notebooks in templates/ #213

Merged
merged 2 commits into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
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
5 changes: 3 additions & 2 deletions .github/workflows/notebooks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
pull_request:
paths:
- "site/en/**"
- "templates/**"
# Allow manual runs
workflow_dispatch:

Expand All @@ -28,7 +29,7 @@ jobs:
readarray -t changed_notebooks < <(git diff --name-only main | grep '\.ipynb$' || true)
else
# Manual run, check everything
readarray -t changed_notebooks < <(find site/en/ -name '*.ipynb')
readarray -t changed_notebooks < <(find site/en/ templates/ -name '*.ipynb')
fi
if [[ ${#changed_notebooks[@]} == 0 ]]; then
echo "No notebooks modified in this pull request."
Expand All @@ -52,7 +53,7 @@ jobs:
run: |
if [ "${{ github.event_name }}" == "pull_request" ]; then
# Only check notebooks modified in this pull request
readarray -t changed_notebooks < <(git diff --name-only main | grep '\.ipynb$' || true)
readarray -t changed_notebooks < <(git diff --name-only main | grep '\.ipynb$' |grep -v '^templates/' || true)
else
# Manual run, check everything
readarray -t changed_notebooks < <(find site/en/ -name '*.ipynb')
Expand Down
162 changes: 76 additions & 86 deletions templates/aistudio_gemini_prompt_chat.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"cellView": "form",
"id": "tuOe1ymfHZPu"
},
"outputs": [],
Expand All @@ -32,32 +33,32 @@
},
{
"cell_type": "markdown",
"source": [
"## Setup"
],
"metadata": {
"id": "FKwyTRdwB8aW"
}
},
"source": [
"## Setup"
]
},
{
"cell_type": "markdown",
"source": [
"### Install & import\n"
],
"metadata": {
"id": "rlE8UqxrDIez"
}
},
"source": [
"### Install & import\n"
]
},
{
"cell_type": "code",
"source": [
"!pip install google-generativelanguage"
],
"execution_count": null,
"metadata": {
"id": "cZiU4TKzznh9"
},
"execution_count": null,
"outputs": []
"outputs": [],
"source": [
"!pip install google-generativelanguage"
]
},
{
"cell_type": "code",
Expand All @@ -80,57 +81,55 @@
},
{
"cell_type": "markdown",
"source": [
"\n",
"\n",
"### Mount Google Drive"
],
"metadata": {
"id": "qZsRPVv1ITbh"
}
},
"source": [
"### Mount Google Drive"
]
},
{
"cell_type": "code",
"source": [
"from google.colab import drive\n",
"drive.mount('/gdrive')"
],
"execution_count": null,
"metadata": {
"id": "d9-t_OkGoLIP"
},
"execution_count": null,
"outputs": []
"outputs": [],
"source": [
"from google.colab import drive\n",
"drive.mount('/gdrive')"
]
},
{
"cell_type": "markdown",
"source": [
"## Set the API key"
],
"metadata": {
"id": "Fet3lFjdKHEM"
}
},
"source": [
"## Set the API key"
]
},
{
"cell_type": "markdown",
"source": [
"Add your API_KEY to the secrets manager in the left pannel \"🔑\"."
],
"metadata": {
"id": "ZoRWILAtCzBE"
}
},
"source": [
"Add your API_KEY to the secrets manager in the left pannel \"🔑\"."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "LaLCwNlkCyQd"
},
"outputs": [],
"source": [
"from google.colab import userdata\n",
"\n",
"API_KEY=userdata.get('API_KEY')"
],
"metadata": {
"id": "LaLCwNlkCyQd"
},
"execution_count": null,
"outputs": []
]
},
{
"cell_type": "code",
Expand All @@ -146,15 +145,20 @@
},
{
"cell_type": "markdown",
"source": [
"### Parse the arguments"
],
"metadata": {
"id": "weo-o73WDpdm"
}
},
"source": [
"### Parse the arguments"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "uIog-0SyDuIF"
},
"outputs": [],
"source": [
"import json\n",
"\n",
Expand All @@ -170,32 +174,27 @@
"\n",
"\n",
"stream = False"
],
"metadata": {
"id": "uIog-0SyDuIF"
},
"execution_count": null,
"outputs": []
]
},
{
"cell_type": "code",
"source": [
"contents"
],
"execution_count": null,
"metadata": {
"id": "wBS8xNhN0x62"
},
"execution_count": null,
"outputs": []
"outputs": [],
"source": [
"contents"
]
},
{
"cell_type": "markdown",
"source": [
"### Call the API"
],
"metadata": {
"id": "E7zAD69vE92b"
}
},
"source": [
"### Call the API"
]
},
{
"cell_type": "code",
Expand All @@ -217,54 +216,45 @@
},
{
"cell_type": "code",
"source": [
"display(Markdown(response.text))"
],
"execution_count": null,
"metadata": {
"id": "Lm3RXwYuGtZK"
},
"execution_count": null,
"outputs": []
"outputs": [],
"source": [
"display(Markdown(response.text))"
]
},
{
"cell_type": "code",
"source": [
"response.prompt_feedback"
],
"execution_count": null,
"metadata": {
"id": "JbKuUc3NGxYD"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"outputs": [],
"source": [
"response.candidates"
],
"metadata": {
"id": "SLAaIq3kgwwJ"
},
"execution_count": null,
"outputs": []
"response.prompt_feedback"
]
},
{
"cell_type": "code",
"source": [],
"execution_count": null,
"metadata": {
"id": "8kS1DntQ2TKM"
"id": "SLAaIq3kgwwJ"
},
"execution_count": null,
"outputs": []
"outputs": [],
"source": [
"response.candidates"
]
}
],
"metadata": {
"colab": {
"provenance": [],
"private_outputs": true,
"collapsed_sections": [
"Tce3stUlHN0L"
]
],
"name": "aistudio_gemini_prompt_chat.ipynb",
"toc_visible": true
},
"kernelspec": {
"display_name": "Python 3",
Expand All @@ -273,4 +263,4 @@
},
"nbformat": 4,
"nbformat_minor": 0
}
}
Loading
Loading