Skip to content

Commit

Permalink
Merge branch 'google-gemini:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
naveenraw25 authored Sep 30, 2024
2 parents 9a4dc25 + 622e647 commit b45e35c
Show file tree
Hide file tree
Showing 94 changed files with 8,702 additions and 1,255 deletions.
17 changes: 17 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "Gemini Cookbook Dev Container",
"image": "mcr.microsoft.com/devcontainers/universal:2",
"waitFor": "onCreateCommand",
"updateContentCommand": "python3 -m pip install ipywidgets",
"customizations": {
"vscode": {
"extensions": [
"ms-toolsai.jupyter",
"ms-python.python",
"eamodio.gitlens"
]
}
},

"postCreateCommand": "sudo cp .devcontainer/welcome.txt /usr/local/etc/vscode-dev-containers/first-run-notice.txt"
}
6 changes: 6 additions & 0 deletions .devcontainer/welcome.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
👋 Welcome to the Gemini API Cookbook! This repo is a collection of all the guides and examples for the Gemini API.
- To get started, make sure you have an API Key from [Google AI
studio](https://aistudio.google.com/app/apikey)
- Note that the notebooks were written to run in Google Colab, so they may
not always work in Codespaces
- Check out the 'README.md' file to know more
55 changes: 55 additions & 0 deletions .github/workflows/new_examples_links_in_table_of_content.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: All new examples are linked in the README

on:
pull_request:
branches: [ main ]

jobs:
new-example-links-in-examples-readme:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Get Changed Files
id: changed-files
uses: tj-actions/changed-files@v45
with:
files: |
examples/**/*.ipynb
- name: Check README links
env:
# We only want the added file so that if we do an exception we dop not have to make an exception again each time qu're editing the file
NEW_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
README: examples/README.md
run: |
all_linked=true
for file in ${NEW_FILES}; do
echo "$file was added"
# Get the directory of the new notebook file
notebook_dir=$(dirname "$file")
# Get the filename without the directory path
filename=$(basename "$file")
# Check if link exists in $README
if ! grep -q "$file" "$README" && ! grep -q "${file/examples\//](}" "$README"; then
# Check if a README.md exists in the sub-folder, and if so, check for the link there
if [[ -f "$notebook_dir/README.md" ]]; then
if ! grep -q "$filename" "$notebook_dir/README.md"; then
all_linked=false
echo " Link to '$file' not found in "$README".md or $notebook_dir/README.md"
echo "::warning file=$file::Link to '$file' not found in a README.md, please add one"
else
echo " Link to '$file' found in $notebook_dir/README.md"
fi
else
all_linked=false
echo " Link to '$file' not found in $README, and no README.md found in $notebook_dir"
echo "::warning file=$file::Link to '$file' not found in $README, please add one (or create a README.md in the sub-folder)"
fi
else
echo " Link to '$file' found in $README"
fi
done
if ! $all_linked; then
exit 1
fi
17 changes: 9 additions & 8 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ name: Mark stale issues and pull requests

on:
schedule:
# Scheduled to run at 1.30 UTC everyday
- cron: '30 1 * * *'
# Scheduled to run at 10.30PM UTC everyday (1530PDT/1430PST)
- cron: '30 22 * * *'
workflow_dispatch:

jobs:
stale:
Expand All @@ -19,28 +20,28 @@ jobs:
pull-requests: write

steps:
- uses: actions/stale@v5
- uses: actions/stale@v9
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
days-before-issue-stale: 14
days-before-issue-close: 14
days-before-issue-close: 13
stale-issue-label: "status:stale"
close-issue-reason: not_planned
any-of-labels: "status:awaiting user response,status:more data needed"
any-of-labels: "status:awaiting response,status:more data needed"
stale-issue-message: >
Marking this issue as stale since it has been open for 14 days with no activity.
This issue will be closed if no further activity occurs.
close-issue-message: >
This issue was closed because it has been inactive for 28 days.
This issue was closed because it has been inactive for 27 days.
Please post a new issue if you need further assistance. Thanks!
days-before-pr-stale: 14
days-before-pr-close: 14
days-before-pr-close: 13
stale-pr-label: "status:stale"
stale-pr-message: >
Marking this pull request as stale since it has been open for 14 days with no activity.
This PR will be closed if no further activity occurs.
close-pr-message: >
This pull request was closed because it has been inactive for 28 days.
This pull request was closed because it has been inactive for 27 days.
Please open a new pull request if you need further assistance. Thanks!
# Label that can be assigned to issues to exclude them from being marked as stale
exempt-issue-labels: 'override-stale'
Expand Down
3 changes: 3 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ Before you send a PR, or even write a single line, please file an [issue](https:

Adding a new guide often involves lots of detailed reviews and we want to make sure that your idea is fully formed and has full support before you start writing anything. If you want to port an existing guide across (e.g. if you have a guide for Gemini on your own GitHub), feel free to link to it in the issue.

When you're ready, start by using the [notebook
template](./templates/Template.ipynb) and following the guidance within.

## Things we consider

When accepting a new guide, we want to balance a few aspects.
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ You can find lots more in the [quickstarts folder](https://github.com/google-gem

## Official SDKs
The Gemini API is a REST API. You can call the API using a command line tool like `curl` (and you can find REST examples [here](https://github.com/google-gemini/cookbook/tree/main/quickstarts/rest)) , or by using one of our official SDKs:
* [Python](https://github.com/google/generative-ai-python) - Note: all the notebooks in this cookbook install the Python SDK for you.
* [Python](https://github.com/google/generative-ai-python) - Note: all the notebooks in this cookbook install the Python SDK for you, and this cookbook is the best place to find Python examples.
* [Node.js](https://github.com/google/generative-ai-js)
* [Dart (Flutter)](https://github.com/google/generative-ai-dart)
* [Android](https://github.com/google/generative-ai-android)
Expand All @@ -43,6 +43,9 @@ The Gemini API is a REST API. You can call the API using a command line tool lik
## Get help
Ask a question on the [Google AI Developer Forum](https://discuss.ai.google.dev/).

## The Gemini API on Google Cloud Vertex AI
If you're an enterprise developer looking to build on a fully-managed platform, you can also use the Gemini API on Google Cloud. Check out this [repo](https://github.com/GoogleCloudPlatform/generative-ai) for lots of cool examples.

## Contributing
Contributions are welcome. See [contributing](https://github.com/google-gemini/cookbook/blob/main/CONTRIBUTING.md) to learn more.

Expand Down
4 changes: 2 additions & 2 deletions examples/Agents_Function_Calling_Barista_Bot.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"\n",
"<table class=\"tfo-notebook-buttons\" align=\"left\">\n",
" <td>\n",
" <a target=\"_blank\" href=\"https://colab.research.google.com/github/google-gemini/cookbook/blob/main/examples/Agents_Function_Calling_Barista_Bot.ipynb\"><img src=\"https://www.tensorflow.org/images/colab_logo_32px.png\" />Run in Google Colab</a>\n",
" <a target=\"_blank\" href=\"https://colab.research.google.com/github/google-gemini/cookbook/blob/main/examples/Agents_Function_Calling_Barista_Bot.ipynb\"><img src=\"../images/colab_logo_32px.png\" />Run in Google Colab</a>\n",
" </td>\n",
"</table>"
]
Expand All @@ -65,7 +65,7 @@
},
"outputs": [],
"source": [
"!pip install -qU google-generativeai"
"!pip install -qU \"google-generativeai>=0.7.2\""
]
},
{
Expand Down
336 changes: 336 additions & 0 deletions examples/Analyze_a_Video_Classification.ipynb

Large diffs are not rendered by default.

Loading

0 comments on commit b45e35c

Please sign in to comment.